9
0
mirror of https://github.com/Auxilor/EcoSkills.git synced 2025-12-31 12:56:31 +00:00

Improved action bar

This commit is contained in:
Auxilor
2021-12-21 17:04:58 +00:00
parent 17376a5a54
commit 8e077683f1
2 changed files with 9 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import com.willfp.eco.core.AbstractPacketAdapter
import com.willfp.eco.core.EcoPlugin
import net.md_5.bungee.api.ChatMessageType
import net.md_5.bungee.api.chat.TextComponent
import org.bukkit.GameMode
import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
@@ -48,6 +49,8 @@ class ActionBarCompatChatMessage(
class ActionBarClearOnGamemode: Listener {
@EventHandler
fun handle(event: PlayerGameModeChangeEvent) {
event.player.spigot().sendMessage(ChatMessageType.ACTION_BAR, *TextComponent.fromLegacyText(""))
if (event.newGameMode == GameMode.CREATIVE || event.newGameMode == GameMode.SPECTATOR) {
event.player.spigot().sendMessage(ChatMessageType.ACTION_BAR, *TextComponent.fromLegacyText(""))
}
}
}

View File

@@ -53,6 +53,11 @@ object ActionBarUtils {
continue
}
if (plugin.configYml.getBool("persistent-action-bar.scale-health")) {
player.isHealthScaled = true
player.healthScale = 20.0
}
val message = plugin.configYml
.getString("persistent-action-bar.format", false)
val component = StringUtils.format(message, player)