mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-21 16:09:24 +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()) {
|
if (this.isBossbarEnabled()) {
|
||||||
createBossBar(entity);
|
createBossBar(entity);
|
||||||
}
|
}
|
||||||
@@ -529,6 +539,7 @@ public class EcoBoss extends PluginDependent {
|
|||||||
|
|
||||||
this.getPlugin().getRunnableFactory().create(runnable -> {
|
this.getPlugin().getRunnableFactory().create(runnable -> {
|
||||||
if (!entity.isDead()) {
|
if (!entity.isDead()) {
|
||||||
|
bossBar.setTitle(entity.getCustomName());
|
||||||
bossBar.setProgress(entity.getHealth() / entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
bossBar.setProgress(entity.getHealth() / entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
||||||
} else {
|
} else {
|
||||||
bossBar.getPlayers().forEach(bossBar::removePlayer);
|
bossBar.getPlayers().forEach(bossBar::removePlayer);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
enabled: true
|
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)
|
base-mob: custom_illusioner # Any existing mob - custom_illusioner is also accepted (like in the old Illusioner plugin)
|
||||||
|
|
||||||
bossbar:
|
bossbar:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
enabled: true
|
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)
|
base-mob: iron_golem # Any existing mob - custom_illusioner is also accepted (like in the old Illusioner plugin)
|
||||||
|
|
||||||
bossbar:
|
bossbar:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
enabled: true
|
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)
|
base-mob: cave_spider # Any existing mob - custom_illusioner is also accepted (like in the old Illusioner plugin)
|
||||||
|
|
||||||
bossbar:
|
bossbar:
|
||||||
|
|||||||
Reference in New Issue
Block a user