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);
}
}
Aggregations