Use GENERIC_MAX_HEALTH when setting and getting boss max health.
setMaxHealth() and getMaxHealth() are deprecated. Partial fix for #406
This commit is contained in:
@@ -3,6 +3,7 @@ package com.garbagemule.MobArena.waves;
|
|||||||
import com.garbagemule.MobArena.healthbar.HealthBar;
|
import com.garbagemule.MobArena.healthbar.HealthBar;
|
||||||
import com.garbagemule.MobArena.things.Thing;
|
import com.garbagemule.MobArena.things.Thing;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ public class MABoss
|
|||||||
*/
|
*/
|
||||||
public MABoss(LivingEntity entity, double maxHealth) {
|
public MABoss(LivingEntity entity, double maxHealth) {
|
||||||
try {
|
try {
|
||||||
entity.setMaxHealth(maxHealth);
|
entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(maxHealth);
|
||||||
entity.setHealth(maxHealth);
|
entity.setHealth(maxHealth);
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// Spigot... *facepalm*
|
// Spigot... *facepalm*
|
||||||
@@ -55,7 +56,7 @@ public class MABoss
|
|||||||
* @return the maximum health of the boss
|
* @return the maximum health of the boss
|
||||||
*/
|
*/
|
||||||
public double getMaxHealth() {
|
public double getMaxHealth() {
|
||||||
return entity.getMaxHealth();
|
return entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user