Add %boosters_active_list% placeholder which displays active boosters names comma separated.

This commit is contained in:
grzybeek
2022-06-18 17:18:01 +02:00
parent cf1afa78a3
commit c59bf2569a
2 changed files with 21 additions and 0 deletions

View File

@@ -196,6 +196,26 @@ class Booster(
"${hh}:${mm}:${ss}"
}
)
PlaceholderManager.registerPlaceholder(
PlayerlessPlaceholder(
plugin,
"active_list",
) {
var activeList = mutableListOf<String>()
for(active in Bukkit.getServer().activeBoosters){
activeList.add(active.booster.name)
}
var outputString = plugin.langYml.getString("no-currently-active-list").formatEco(formatPlaceholders = false)
if (activeList.size > 0) {
outputString = activeList.joinToString(", ")
}
outputString
}
)
}
override fun equals(other: Any?): Boolean {

View File

@@ -18,4 +18,5 @@ messages:
cannot-transmit: "&cYou can't transmit here!"
no-currently-active: "&cNot Active!"
no-currently-active-list: "&cThere isn't any booster active!"
active-placeholder: "&fThanks %player% &ffor activating %booster%&f!"