mirror of
https://github.com/zeshan321/ActionHealth.git
synced 2025-03-10 13:49:07 +01:00
Fixed casting error and checking if entity is dead
This commit is contained in:
parent
4e7676df8d
commit
ce78bbc078
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: ActionHealth
|
||||
main: com.zeshanaslam.actionhealth.Main
|
||||
version: 3.1.1
|
||||
version: 3.1.2
|
||||
commands:
|
||||
Actionhealth:
|
||||
description: Actionhealth main command.
|
@ -62,9 +62,10 @@ public class HealthListeners implements Listener {
|
||||
}
|
||||
|
||||
// Send health
|
||||
LivingEntity livingEntity = (LivingEntity) damaged;
|
||||
plugin.healthUtil.sendHealth(player, (LivingEntity) damaged, (int) (livingEntity.getHealth() - event.getFinalDamage()));
|
||||
|
||||
if (damaged instanceof LivingEntity) {
|
||||
LivingEntity livingEntity = (LivingEntity) damaged;
|
||||
plugin.healthUtil.sendHealth(player, (LivingEntity) damaged, (int) (livingEntity.getHealth() - event.getFinalDamage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,8 +92,10 @@ public class HealthListeners implements Listener {
|
||||
}
|
||||
|
||||
// Send health
|
||||
LivingEntity livingEntity = (LivingEntity) damaged;
|
||||
plugin.healthUtil.sendHealth(player, (LivingEntity) damaged, (int) (livingEntity.getHealth() - event.getFinalDamage()));
|
||||
if (damaged instanceof LivingEntity) {
|
||||
LivingEntity livingEntity = (LivingEntity) damaged;
|
||||
plugin.healthUtil.sendHealth(player, (LivingEntity) damaged, (int) (livingEntity.getHealth() - event.getFinalDamage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class HealthUtil {
|
||||
String name;
|
||||
int maxHealth = (int) entity.getMaxHealth();
|
||||
|
||||
if (health < 0) health = 0;
|
||||
if (health < 0 || entity.isDead()) health = 0;
|
||||
|
||||
if (entity.getCustomName() == null) {
|
||||
name = entity.getName();
|
||||
@ -69,7 +69,7 @@ public class HealthUtil {
|
||||
}
|
||||
}
|
||||
|
||||
if (tempHealth >= 0) {
|
||||
if (tempHealth > 0) {
|
||||
style = style + plugin.settingsManager.halfHeartIcon;
|
||||
left--;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user