Search in sources :

Example 11 with Objective

use of org.bukkit.scoreboard.Objective in project Glowstone by GlowstoneMC.

the class GlowArmorStand method setHealth.

private void setHealth(double health, boolean drop) {
    if (health < 0)
        health = 0;
    if (health > getMaxHealth())
        health = getMaxHealth();
    this.health = health;
    metadata.set(MetadataIndex.HEALTH, (float) health);
    for (Objective objective : getServer().getScoreboardManager().getMainScoreboard().getObjectivesByCriteria(Criterias.HEALTH)) {
        objective.getScore(getName()).setScore((int) health);
    }
    if (health == 0) {
        kill(drop);
    }
}
Also used : Objective(org.bukkit.scoreboard.Objective)

Aggregations

Objective (org.bukkit.scoreboard.Objective)11 Team (org.bukkit.scoreboard.Team)5 Scoreboard (org.bukkit.scoreboard.Scoreboard)4 Player (org.bukkit.entity.Player)3 ArrayList (java.util.ArrayList)2 Format (java.text.Format)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 net.aufdemrand.denizen.objects.dPlayer (net.aufdemrand.denizen.objects.dPlayer)1 Element (net.aufdemrand.denizencore.objects.Element)1 net.aufdemrand.denizencore.objects.dList (net.aufdemrand.denizencore.objects.dList)1 LootData (net.glowstone.util.loot.LootData)1 CompoundTag (net.glowstone.util.nbt.CompoundTag)1 ChatColor (org.bukkit.ChatColor)1 OfflinePlayer (org.bukkit.OfflinePlayer)1 ItemStack (org.bukkit.inventory.ItemStack)1 DisplaySlot (org.bukkit.scoreboard.DisplaySlot)1