mirror of
https://github.com/zeshan321/ActionHealth.git
synced 2024-09-28 07:07:36 +02:00
Added 1.13 support and non player health message
This commit is contained in:
parent
2a22a32e72
commit
21ff4d5666
@ -7,6 +7,11 @@
|
|||||||
# Has support for PlaceholderAPI and MVdWPlaceholderAPI.
|
# Has support for PlaceholderAPI and MVdWPlaceholderAPI.
|
||||||
Health Message: '&7&l{name}: {usestyle}'
|
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.
|
# The message the player is sent to the player if they have actionhealth disabled.
|
||||||
# {name} shows the name of the player.
|
# {name} shows the name of the player.
|
||||||
Toggle Message: ''
|
Toggle Message: ''
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
name: ActionHealth
|
name: ActionHealth
|
||||||
main: com.zeshanaslam.actionhealth.Main
|
main: com.zeshanaslam.actionhealth.Main
|
||||||
version: 3.2.2
|
version: 3.2.3
|
||||||
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI]
|
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI]
|
||||||
commands:
|
commands:
|
||||||
Actionhealth:
|
Actionhealth:
|
||||||
|
@ -89,9 +89,6 @@ public class HealthUtil {
|
|||||||
name = plugin.settingsManager.translate.get(entity.getName());
|
name = plugin.settingsManager.translate.get(entity.getName());
|
||||||
|
|
||||||
String output = plugin.settingsManager.healthMessage;
|
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) {
|
if (entity instanceof Player) {
|
||||||
String displayName;
|
String displayName;
|
||||||
@ -114,9 +111,17 @@ public class HealthUtil {
|
|||||||
output = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, output);
|
output = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, output);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (!plugin.settingsManager.healthMessageOther.isEmpty()) {
|
||||||
|
output = plugin.settingsManager.healthMessageOther;
|
||||||
|
}
|
||||||
|
|
||||||
output = output.replace("{displayname}", name);
|
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}")) {
|
if (output.contains("{usestyle}")) {
|
||||||
StringBuilder style = new StringBuilder();
|
StringBuilder style = new StringBuilder();
|
||||||
int left = plugin.settingsManager.limitHealth;
|
int left = plugin.settingsManager.limitHealth;
|
||||||
@ -165,7 +170,7 @@ public class HealthUtil {
|
|||||||
message = ChatColor.translateAlternateColorCodes('&', message);
|
message = ChatColor.translateAlternateColorCodes('&', message);
|
||||||
|
|
||||||
try {
|
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);
|
new PreAction(player, message);
|
||||||
} else if (!(plugin.settingsManager.mcVersion.equalsIgnoreCase("v1_8_R1") || (plugin.settingsManager.mcVersion.contains("v1_7_")))) {
|
} 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");
|
Class<?> c1 = Class.forName("org.bukkit.craftbukkit." + plugin.settingsManager.mcVersion + ".entity.CraftPlayer");
|
||||||
|
@ -12,6 +12,7 @@ import java.util.stream.Collectors;
|
|||||||
public class SettingsManager {
|
public class SettingsManager {
|
||||||
|
|
||||||
public String healthMessage;
|
public String healthMessage;
|
||||||
|
public String healthMessageOther;
|
||||||
public boolean usePerms;
|
public boolean usePerms;
|
||||||
public boolean showMobs;
|
public boolean showMobs;
|
||||||
public boolean showPlayers;
|
public boolean showPlayers;
|
||||||
@ -57,6 +58,12 @@ public class SettingsManager {
|
|||||||
|
|
||||||
// Get settings from config
|
// Get settings from config
|
||||||
healthMessage = plugin.getConfig().getString("Health Message");
|
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");
|
usePerms = plugin.getConfig().getBoolean("Use Permissions");
|
||||||
showMobs = plugin.getConfig().getBoolean("Show Mob");
|
showMobs = plugin.getConfig().getBoolean("Show Mob");
|
||||||
showPlayers = plugin.getConfig().getBoolean("Show Player");
|
showPlayers = plugin.getConfig().getBoolean("Show Player");
|
||||||
|
Loading…
Reference in New Issue
Block a user