mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-21 07:59:28 +00:00
Added %health% placeholder to show entity health in name
This commit is contained in:
@@ -499,6 +499,16 @@ public class EcoBoss extends PluginDependent {
|
||||
);
|
||||
}
|
||||
|
||||
this.getPlugin().getRunnableFactory().create(runnable -> {
|
||||
String name = entity.getCustomName();
|
||||
assert name != null;
|
||||
|
||||
entity.setCustomName(name.replace("%health%", StringUtils.internalToString(entity.getHealth())));
|
||||
if (entity.isDead()) {
|
||||
runnable.cancel();
|
||||
}
|
||||
}).runTaskTimer(0, 1);
|
||||
|
||||
if (this.isBossbarEnabled()) {
|
||||
createBossBar(entity);
|
||||
}
|
||||
@@ -529,6 +539,7 @@ public class EcoBoss extends PluginDependent {
|
||||
|
||||
this.getPlugin().getRunnableFactory().create(runnable -> {
|
||||
if (!entity.isDead()) {
|
||||
bossBar.setTitle(entity.getCustomName());
|
||||
bossBar.setProgress(entity.getHealth() / entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
||||
} else {
|
||||
bossBar.getPlayers().forEach(bossBar::removePlayer);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
enabled: true
|
||||
|
||||
name: "&9Illusioner" # Display name
|
||||
name: "&9Illusioner &7| &c%health%♥" # Display name
|
||||
base-mob: custom_illusioner # Any existing mob - custom_illusioner is also accepted (like in the old Illusioner plugin)
|
||||
|
||||
bossbar:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
enabled: true
|
||||
|
||||
name: "&8Steel Golem" # Display name
|
||||
name: "&8Steel Golem &7| &c%health%♥" # Display name
|
||||
base-mob: iron_golem # Any existing mob - custom_illusioner is also accepted (like in the old Illusioner plugin)
|
||||
|
||||
bossbar:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
enabled: true
|
||||
|
||||
name: "&4Tarantula" # Display name
|
||||
name: "&4Tarantula &7| &c%health%♥" # Display name
|
||||
base-mob: cave_spider # Any existing mob - custom_illusioner is also accepted (like in the old Illusioner plugin)
|
||||
|
||||
bossbar:
|
||||
|
||||
Reference in New Issue
Block a user