mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2026-01-04 15:41:36 +00:00
Added health scaling option
This commit is contained in:
@@ -7,6 +7,7 @@ import com.willfp.eco.core.integrations.IntegrationLoader;
|
||||
import com.willfp.ecoskills.actionbar.ActionBarCompatChatMessage;
|
||||
import com.willfp.ecoskills.actionbar.ActionBarCompatSetActionBar;
|
||||
import com.willfp.ecoskills.actionbar.ActionBarUtils;
|
||||
import com.willfp.ecoskills.actionbar.HealthScaleListener;
|
||||
import com.willfp.ecoskills.commands.CommandEcoskills;
|
||||
import com.willfp.ecoskills.commands.CommandSkills;
|
||||
import com.willfp.ecoskills.config.EffectsYml;
|
||||
@@ -121,7 +122,8 @@ public class EcoSkillsPlugin extends EcoPlugin {
|
||||
new SkillDisplayListener(this),
|
||||
new StatModifierListener(),
|
||||
new DataListener(),
|
||||
new DamageIndicatorListener(this)
|
||||
new DamageIndicatorListener(this),
|
||||
new HealthScaleListener(this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.willfp.ecoskills.actionbar
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.event.entity.EntityDamageEvent
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent
|
||||
|
||||
class HealthScaleListener(
|
||||
private val plugin: EcoPlugin
|
||||
) : Listener {
|
||||
@EventHandler
|
||||
fun scaleHealth(event: EntityRegainHealthEvent) {
|
||||
val player = event.entity as? Player ?: return
|
||||
|
||||
if (!plugin.configYml.getBool("persistent-action-bar.scale-health")) {
|
||||
return
|
||||
}
|
||||
|
||||
player.isHealthScaled = true
|
||||
player.healthScale = 20.0
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun scaleHealth(event: EntityDamageEvent) {
|
||||
val player = event.entity as? Player ?: return
|
||||
|
||||
if (!plugin.configYml.getBool("persistent-action-bar.scale-health")) {
|
||||
return
|
||||
}
|
||||
|
||||
player.isHealthScaled = true
|
||||
player.healthScale = 20.0
|
||||
}
|
||||
}
|
||||
@@ -317,8 +317,10 @@ damage-indicators:
|
||||
persistent-action-bar:
|
||||
# If the persistent action bar should be enabled
|
||||
enabled: true
|
||||
# If a player's health should be scaled to always display as 10 hearts.
|
||||
scale-health: true
|
||||
# The format
|
||||
format: "&c❤ &f%player_health_rounded%/%player_max_health_rounded% &#e884b0🛡 &f%ecoskills_defense% &8| &#db0000🗡 &f%ecoskills_strength%"
|
||||
format: "&c❤ &f%player_health_rounded%&8/&f%player_max_health_rounded% &#e884b0🛡 &f%ecoskills_defense% &8| &#db0000🗡 &f%ecoskills_strength% &8| (ffe6✦ &f%ecoskills_speed%"
|
||||
|
||||
commands:
|
||||
top:
|
||||
|
||||
Reference in New Issue
Block a user