1.17.x Why Attribute setBaseValue is not working?

Discussion in 'Spigot Plugin Development' started by Hwagan, Jul 18, 2021.

  1. package Main.events;

    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.attribute.Attribute;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;

    public class events implements Listener{
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();
    player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(16.0D);
    }
    }

    code

    setBaseValue is not working in my server...
     

  2. Try doing it one tick later.