Display half health icon more accurately

This commit is contained in:
Zeshan Aslam 2017-03-23 00:15:16 -04:00
parent ce78bbc078
commit b45e1a7ec3
3 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,6 @@
name: ActionHealth
main: com.zeshanaslam.actionhealth.Main
version: 3.1.2
version: 3.1.3
commands:
Actionhealth:
description: Actionhealth main command.

View File

@ -57,6 +57,7 @@ public class HealthUtil {
String style = "";
int left = 10;
int heart = maxHealth / 10;
int halfHeart = heart / 2;
int tempHealth = health;
if (maxHealth != health && health >= 0 && !entity.isDead()) {
@ -69,9 +70,14 @@ public class HealthUtil {
}
}
if (tempHealth > 0) {
style = style + plugin.settingsManager.halfHeartIcon;
if (tempHealth > halfHeart) {
style = style + plugin.settingsManager.filledHeartIcon;
left--;
} else {
if (tempHealth > 0 && tempHealth <= halfHeart) {
style = style + plugin.settingsManager.halfHeartIcon;
left--;
}
}
}