Added 'percenthealth' placeholder

This commit is contained in:
Zeshan Aslam 2020-06-25 22:04:35 -04:00
parent f4671413b3
commit e54cc146f0
2 changed files with 2 additions and 0 deletions

View File

@ -5,6 +5,7 @@
# {usestyle} will use the defined chars.
# {displayname} will use player/mob custom name.
# {opponentlastdamage} the amount of damage the enemy last received.
# {percenthealth} displays the percentage of health left.
# Has support for PlaceholderAPI and MVdWPlaceholderAPI.
Health Message: '&7&l{name}: {usestyle}'

View File

@ -122,6 +122,7 @@ public class HealthUtil {
output = output.replace("{name}", name);
output = output.replace("{health}", String.valueOf((int) health));
output = output.replace("{maxhealth}", String.valueOf((int) maxHealth));
output = output.replace("{percenthealth}", String.valueOf((int) ((health / maxHealth) * 100.0)));
output = output.replace("{opponentlastdamage}", String.valueOf((int) entity.getLastDamage()));
if (output.contains("{usestyle}")) {