mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2025-12-31 12:56:31 +00:00
Fixed boss bar bugs
This commit is contained in:
@@ -63,16 +63,22 @@ class SkillDisplayListener(
|
||||
string = string.replace("%gained_xp%", NumberUtils.format(amount))
|
||||
val ratio = currentXp / nextLevel
|
||||
|
||||
val bossBar = Bukkit.createBossBar(
|
||||
val key = plugin.namespacedKeyFactory.create("${player.name.substring(0, 2)}${skill.id}")
|
||||
|
||||
val bossBar = Bukkit.getBossBar(key) ?: Bukkit.createBossBar(
|
||||
key,
|
||||
string,
|
||||
BarColor.valueOf(this.plugin.configYml.getString("skills.progress.boss-bar.color").uppercase()),
|
||||
BarStyle.valueOf(this.plugin.configYml.getString("skills.progress.boss-bar.style").uppercase())
|
||||
)
|
||||
|
||||
bossBar.setTitle(string)
|
||||
bossBar.progress = ratio
|
||||
|
||||
bossBar.addPlayer(player)
|
||||
this.plugin.scheduler.runLater(this.plugin.configYml.getInt("skills.progress.boss-bar.duration").toLong()) {
|
||||
this.plugin.scheduler.runLater(
|
||||
this.plugin.configYml.getInt("skills.progress.boss-bar.duration").toLong()
|
||||
) {
|
||||
bossBar.removePlayer(player)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,11 +243,13 @@ skills:
|
||||
# If the boss bar should be used
|
||||
enabled: false
|
||||
# The boss bar message that should be sent
|
||||
format: "&f%skill% &8| &9(%current_xp%/%required_xp%) &e+%gained_xp%"
|
||||
format: "&f%skill% &8| &9(%current_xp%/%required_xp%)"
|
||||
# The color of the boss bar (from https://hub.spigotmc.org/javadocs/spigot/org/bukkit/boss/BarColor.html)
|
||||
color: pink
|
||||
# The style of the boss bar (from https://hub.spigotmc.org/javadocs/spigot/org/bukkit/boss/BarStyle.html)
|
||||
style: solid
|
||||
# How long the boss bar should last (in ticks)
|
||||
duration: 60
|
||||
sound:
|
||||
# If a sound should be played
|
||||
enabled: true
|
||||
|
||||
Reference in New Issue
Block a user