9
0
mirror of https://github.com/Auxilor/EcoMobs.git synced 2025-12-20 07:29:21 +00:00

Added max_health placeholder

This commit is contained in:
Auxilor
2023-11-12 14:03:54 +00:00
parent c17916d548
commit f2170278f8
2 changed files with 14 additions and 0 deletions

View File

@@ -14,11 +14,13 @@ import com.willfp.ecomobs.mob.event.impl.MobEventRangedAttack
import com.willfp.ecomobs.mob.event.impl.MobEventSpawn
import com.willfp.ecomobs.mob.event.impl.MobEventTakeDamage
import com.willfp.ecomobs.mob.placeholder.impl.MobPlaceholderHealth
import com.willfp.ecomobs.mob.placeholder.impl.MobPlaceholderMaxHealth
import com.willfp.ecomobs.mob.placeholder.impl.MobPlaceholderTime
object MobPlaceholders : Registry<MobPlaceholder>() {
init {
register(MobPlaceholderHealth)
register(MobPlaceholderMaxHealth)
register(MobPlaceholderTime)
}
}

View File

@@ -0,0 +1,12 @@
package com.willfp.ecomobs.mob.placeholder.impl
import com.willfp.eco.util.toNiceString
import com.willfp.ecomobs.mob.LivingMob
import com.willfp.ecomobs.mob.placeholder.MobPlaceholder
import org.bukkit.attribute.Attribute
object MobPlaceholderMaxHealth : MobPlaceholder("max_health") {
override fun getValue(mob: LivingMob): String {
return mob.entity.getAttribute(Attribute.GENERIC_MAX_HEALTH)?.value.toNiceString()
}
}