mirror of
https://github.com/zeshan321/ActionHealth.git
synced 2024-06-26 14:44:50 +02:00
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.
|
# {health} shows current health of the mob or player.
|
||||||
# {maxhealth} shows the max health of the mob or player.
|
# {maxhealth} shows the max health of the mob or player.
|
||||||
# {usestyle} will use the defined chars.
|
# {usestyle} will use the defined chars.
|
||||||
|
|
||||||
Health Message: '&7&l{name}: {usestyle}'
|
Health Message: '&7&l{name}: {usestyle}'
|
||||||
|
|
||||||
# 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: ''
|
||||||
|
|
||||||
# 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
|
Strip Name: true
|
||||||
|
|
||||||
# If enabled players with the permission 'ActionHealth.Health' will only see the action health message.
|
# If enabled players with the permission 'ActionHealth.Health' will only see the action health message.
|
||||||
|
|
||||||
Use Permissions: false
|
Use Permissions: false
|
||||||
|
|
||||||
# If set to false player will not see health messages from mobs.
|
# If set to false player will not see health messages from mobs.
|
||||||
|
|
||||||
Show Mob: true
|
Show Mob: true
|
||||||
|
|
||||||
# If set to false player will not see health messages from other players.
|
# If set to false player will not see health messages from other players.
|
||||||
|
|
||||||
Show Player: true
|
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.
|
# 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 :(
|
# This also uses more resources :(
|
||||||
|
|
||||||
Delay Message: false
|
Delay Message: false
|
||||||
|
|
||||||
# Style Health
|
# Style Health
|
||||||
|
|
Binary file not shown.
Binary file not shown.
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.1.4
|
version: 3.1.5
|
||||||
commands:
|
commands:
|
||||||
Actionhealth:
|
Actionhealth:
|
||||||
description: Actionhealth main command.
|
description: Actionhealth main command.
|
|
@ -39,11 +39,11 @@ public class HealthCommand implements CommandExecutor {
|
||||||
if (plugin.toggle.contains(player.getUniqueId())) {
|
if (plugin.toggle.contains(player.getUniqueId())) {
|
||||||
plugin.toggle.remove(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 {
|
} else {
|
||||||
plugin.toggle.add(player.getUniqueId());
|
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) {
|
if (plugin.settingsManager.rememberToggle) {
|
||||||
|
|
|
@ -39,10 +39,6 @@ public class HealthListeners implements Listener {
|
||||||
|
|
||||||
|
|
||||||
Entity damaged = event.getEntity();
|
Entity damaged = event.getEntity();
|
||||||
if (event.getDamager().getUniqueId() == damaged.getUniqueId()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.getDamager() instanceof Projectile) {
|
if (event.getDamager() instanceof Projectile) {
|
||||||
Projectile projectile = (Projectile) event.getDamager();
|
Projectile projectile = (Projectile) event.getDamager();
|
||||||
|
|
||||||
|
@ -60,6 +56,10 @@ public class HealthListeners implements Listener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player.getUniqueId() == damaged.getUniqueId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (plugin.toggle.contains(player.getUniqueId())) {
|
if (plugin.toggle.contains(player.getUniqueId())) {
|
||||||
if (plugin.settingsManager.toggleMessage != null && !plugin.settingsManager.toggleMessage.equals("")) {
|
if (plugin.settingsManager.toggleMessage != null && !plugin.settingsManager.toggleMessage.equals("")) {
|
||||||
plugin.healthUtil.sendActionBar(player, plugin.settingsManager.toggleMessage.replace("{name}", player.getName()));
|
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) {
|
if (event.getDamager() instanceof Player) {
|
||||||
Player player = (Player) event.getDamager();
|
Player player = (Player) event.getDamager();
|
||||||
|
|
||||||
|
if (player.getUniqueId() == damaged.getUniqueId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the setting 'Show Player' is enabled
|
// Check if the setting 'Show Player' is enabled
|
||||||
if (event.getEntity() instanceof Player) {
|
if (event.getEntity() instanceof Player) {
|
||||||
if (!plugin.settingsManager.showPlayers) {
|
if (!plugin.settingsManager.showPlayers) {
|
||||||
|
@ -94,6 +98,9 @@ public class HealthListeners implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.toggle.contains(player.getUniqueId())) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class LookThread extends BukkitRunnable {
|
||||||
name = livingEntity.getCustomName();
|
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());
|
plugin.healthUtil.sendHealth(player, livingEntity, livingEntity.getHealth());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,8 @@ public class SettingsManager {
|
||||||
public double lookDistance;
|
public double lookDistance;
|
||||||
public List<String> blacklist = new ArrayList<>();
|
public List<String> blacklist = new ArrayList<>();
|
||||||
public String toggleMessage;
|
public String toggleMessage;
|
||||||
|
public String enableMessage;
|
||||||
|
public String disableMessage;
|
||||||
|
|
||||||
public SettingsManager(Main plugin) {
|
public SettingsManager(Main plugin) {
|
||||||
// Clear settings for reloads
|
// Clear settings for reloads
|
||||||
|
@ -96,5 +98,17 @@ public class SettingsManager {
|
||||||
if (plugin.getConfig().contains("Toggle Message")) {
|
if (plugin.getConfig().contains("Toggle Message")) {
|
||||||
toggleMessage = plugin.getConfig().getString("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
Block a user