diff --git a/config.yml b/config.yml index b06874c..acaf4ee 100644 --- a/config.yml +++ b/config.yml @@ -7,6 +7,11 @@ # Has support for PlaceholderAPI and MVdWPlaceholderAPI. Health Message: '&7&l{name}: {usestyle}' +# If set empty it will default to the one above. +# This message is sent to all non player entities. +# All the placeholders from above work here also. +Non Player Message: '' + # The message the player is sent to the player if they have actionhealth disabled. # {name} shows the name of the player. Toggle Message: '' diff --git a/out/production/ActionHealth/com/zeshanaslam/actionhealth/HealthUtil.class b/out/production/ActionHealth/com/zeshanaslam/actionhealth/HealthUtil.class index 80230cc..13d95b1 100644 Binary files a/out/production/ActionHealth/com/zeshanaslam/actionhealth/HealthUtil.class and b/out/production/ActionHealth/com/zeshanaslam/actionhealth/HealthUtil.class differ diff --git a/out/production/ActionHealth/com/zeshanaslam/actionhealth/SettingsManager.class b/out/production/ActionHealth/com/zeshanaslam/actionhealth/SettingsManager.class index 652e97a..17b9948 100644 Binary files a/out/production/ActionHealth/com/zeshanaslam/actionhealth/SettingsManager.class and b/out/production/ActionHealth/com/zeshanaslam/actionhealth/SettingsManager.class differ diff --git a/plugin.yml b/plugin.yml index 179a928..adb081a 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: ActionHealth main: com.zeshanaslam.actionhealth.Main -version: 3.2.2 +version: 3.2.3 softdepend: [PlaceholderAPI, MVdWPlaceholderAPI] commands: Actionhealth: diff --git a/src/com/zeshanaslam/actionhealth/HealthUtil.java b/src/com/zeshanaslam/actionhealth/HealthUtil.java index c45d80c..f2ffc3d 100644 --- a/src/com/zeshanaslam/actionhealth/HealthUtil.java +++ b/src/com/zeshanaslam/actionhealth/HealthUtil.java @@ -89,9 +89,6 @@ public class HealthUtil { name = plugin.settingsManager.translate.get(entity.getName()); String output = plugin.settingsManager.healthMessage; - output = output.replace("{name}", name); - output = output.replace("{health}", String.valueOf((int) health)); - output = output.replace("{maxhealth}", String.valueOf((int) maxHealth)); if (entity instanceof Player) { String displayName; @@ -114,9 +111,17 @@ public class HealthUtil { output = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, output); } } else { + if (!plugin.settingsManager.healthMessageOther.isEmpty()) { + output = plugin.settingsManager.healthMessageOther; + } + output = output.replace("{displayname}", name); } + output = output.replace("{name}", name); + output = output.replace("{health}", String.valueOf((int) health)); + output = output.replace("{maxhealth}", String.valueOf((int) maxHealth)); + if (output.contains("{usestyle}")) { StringBuilder style = new StringBuilder(); int left = plugin.settingsManager.limitHealth; @@ -165,7 +170,7 @@ public class HealthUtil { message = ChatColor.translateAlternateColorCodes('&', message); try { - if (plugin.settingsManager.mcVersion.equals("v1_12_R1")) { + if (plugin.settingsManager.mcVersion.equals("v1_12_R1") || plugin.settingsManager.mcVersion.equals("v1_13_R1")) { new PreAction(player, message); } else if (!(plugin.settingsManager.mcVersion.equalsIgnoreCase("v1_8_R1") || (plugin.settingsManager.mcVersion.contains("v1_7_")))) { Class c1 = Class.forName("org.bukkit.craftbukkit." + plugin.settingsManager.mcVersion + ".entity.CraftPlayer"); diff --git a/src/com/zeshanaslam/actionhealth/SettingsManager.java b/src/com/zeshanaslam/actionhealth/SettingsManager.java index af8263a..c93836f 100644 --- a/src/com/zeshanaslam/actionhealth/SettingsManager.java +++ b/src/com/zeshanaslam/actionhealth/SettingsManager.java @@ -12,6 +12,7 @@ import java.util.stream.Collectors; public class SettingsManager { public String healthMessage; + public String healthMessageOther; public boolean usePerms; public boolean showMobs; public boolean showPlayers; @@ -57,6 +58,12 @@ public class SettingsManager { // Get settings from config healthMessage = plugin.getConfig().getString("Health Message"); + + healthMessageOther = ""; + if (plugin.getConfig().contains("Non Player Message")) { + healthMessageOther = plugin.getConfig().getString("Non Player Message"); + } + usePerms = plugin.getConfig().getBoolean("Use Permissions"); showMobs = plugin.getConfig().getBoolean("Show Mob"); showPlayers = plugin.getConfig().getBoolean("Show Player");