Bug fixes and messages
Added: - The ability to customize the message when you use /actionhealth toggle. Fixed: - Check if entity is a npc when look is enabled. - Showing health message when damaging self.
This commit is contained in:
parent
8f598ab6b8
commit
ec257f3b41
14
config.yml
14
config.yml
|
@ -3,32 +3,34 @@
|
|||
# {health} shows current health of the mob or player.
|
||||
# {maxhealth} shows the max health of the mob or player.
|
||||
# {usestyle} will use the defined chars.
|
||||
|
||||
Health Message: '&7&l{name}: {usestyle}'
|
||||
|
||||
# The message the player is sent to the player if they have actionhealth disabled.
|
||||
# {name} shows the name of the player.
|
||||
Toggle Message: ''
|
||||
|
||||
# Strip Name.
|
||||
# Message sent to player when player enables actionhealth
|
||||
# {name} shows the name of the player.
|
||||
On Enable: '&7ActionHealth has been &cenabled&7.'
|
||||
|
||||
# Message sent to player when player disables actionhealth
|
||||
# {name} shows the name of the player.
|
||||
On Disable: '&7ActionHealth has been &cdisabled&7.'
|
||||
|
||||
# Strip Name.
|
||||
Strip Name: true
|
||||
|
||||
# If enabled players with the permission 'ActionHealth.Health' will only see the action health message.
|
||||
|
||||
Use Permissions: false
|
||||
|
||||
# If set to false player will not see health messages from mobs.
|
||||
|
||||
Show Mob: true
|
||||
|
||||
# If set to false player will not see health messages from other players.
|
||||
|
||||
Show Player: true
|
||||
|
||||
# If set to true player will get the message in a delay to get 100% accurate health. Useful for plugins that add damage by reading item lore.
|
||||
# This also uses more resources :(
|
||||
|
||||
Delay Message: false
|
||||
|
||||
# Style Health
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
name: ActionHealth
|
||||
main: com.zeshanaslam.actionhealth.Main
|
||||
version: 3.1.4
|
||||
version: 3.1.5
|
||||
commands:
|
||||
Actionhealth:
|
||||
description: Actionhealth main command.
|
|
@ -39,11 +39,11 @@ public class HealthCommand implements CommandExecutor {
|
|||
if (plugin.toggle.contains(player.getUniqueId())) {
|
||||
plugin.toggle.remove(player.getUniqueId());
|
||||
|
||||
player.sendMessage(ChatColor.GRAY + "ActionHealth has been " + ChatColor.RED + "enabled" + ChatColor.GRAY + ".");
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.settingsManager.enableMessage).replace("{name}", player.getName()));
|
||||
} else {
|
||||
plugin.toggle.add(player.getUniqueId());
|
||||
|
||||
player.sendMessage(ChatColor.GRAY + "ActionHealth has been " + ChatColor.RED + "disabled" + ChatColor.GRAY + ".");
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.settingsManager.disableMessage).replace("{name}", player.getName()));
|
||||
}
|
||||
|
||||
if (plugin.settingsManager.rememberToggle) {
|
||||
|
|
|
@ -39,10 +39,6 @@ public class HealthListeners implements Listener {
|
|||
|
||||
|
||||
Entity damaged = event.getEntity();
|
||||
if (event.getDamager().getUniqueId() == damaged.getUniqueId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getDamager() instanceof Projectile) {
|
||||
Projectile projectile = (Projectile) event.getDamager();
|
||||
|
||||
|
@ -60,6 +56,10 @@ public class HealthListeners implements Listener {
|
|||
return;
|
||||
}
|
||||
|
||||
if (player.getUniqueId() == damaged.getUniqueId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.toggle.contains(player.getUniqueId())) {
|
||||
if (plugin.settingsManager.toggleMessage != null && !plugin.settingsManager.toggleMessage.equals("")) {
|
||||
plugin.healthUtil.sendActionBar(player, plugin.settingsManager.toggleMessage.replace("{name}", player.getName()));
|
||||
|
@ -78,6 +78,10 @@ public class HealthListeners implements Listener {
|
|||
if (event.getDamager() instanceof Player) {
|
||||
Player player = (Player) event.getDamager();
|
||||
|
||||
if (player.getUniqueId() == damaged.getUniqueId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the setting 'Show Player' is enabled
|
||||
if (event.getEntity() instanceof Player) {
|
||||
if (!plugin.settingsManager.showPlayers) {
|
||||
|
@ -94,6 +98,9 @@ public class HealthListeners implements Listener {
|
|||
}
|
||||
|
||||
if (plugin.toggle.contains(player.getUniqueId())) {
|
||||
if (plugin.settingsManager.toggleMessage != null && !plugin.settingsManager.toggleMessage.equals("")) {
|
||||
plugin.healthUtil.sendActionBar(player, plugin.settingsManager.toggleMessage.replace("{name}", player.getName()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public class LookThread extends BukkitRunnable {
|
|||
name = livingEntity.getCustomName();
|
||||
}
|
||||
|
||||
if (!plugin.settingsManager.blacklist.contains(name)) {
|
||||
if (!plugin.settingsManager.blacklist.contains(name) && !livingEntity.hasMetadata("NPC")) {
|
||||
plugin.healthUtil.sendHealth(player, livingEntity, livingEntity.getHealth());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,8 @@ public class SettingsManager {
|
|||
public double lookDistance;
|
||||
public List<String> blacklist = new ArrayList<>();
|
||||
public String toggleMessage;
|
||||
public String enableMessage;
|
||||
public String disableMessage;
|
||||
|
||||
public SettingsManager(Main plugin) {
|
||||
// Clear settings for reloads
|
||||
|
@ -96,5 +98,17 @@ public class SettingsManager {
|
|||
if (plugin.getConfig().contains("Toggle Message")) {
|
||||
toggleMessage = plugin.getConfig().getString("Toggle Message");
|
||||
}
|
||||
|
||||
if (plugin.getConfig().contains("On Enable")) {
|
||||
enableMessage = plugin.getConfig().getString("On Enable");
|
||||
} else {
|
||||
enableMessage = "&7ActionHealth has been &cenabled&7.";
|
||||
}
|
||||
|
||||
if (plugin.getConfig().contains("On Disable")) {
|
||||
disableMessage = plugin.getConfig().getString("On Disable");
|
||||
} else {
|
||||
disableMessage = "&7ActionHealth has been &cdisabled&7.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue