diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/boosters/BoosterUtils.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/boosters/BoosterUtils.kt index 2512a1d..e434891 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/boosters/BoosterUtils.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/boosters/BoosterUtils.kt @@ -6,7 +6,6 @@ import com.willfp.boosters.boosters.ActivatedBooster import com.willfp.boosters.boosters.Booster import com.willfp.boosters.boosters.Boosters import com.willfp.boosters.boosters.activateBooster -import com.willfp.eco.core.data.ServerProfile import com.willfp.eco.core.data.profile import org.bukkit.Bukkit import org.bukkit.OfflinePlayer @@ -53,10 +52,10 @@ fun Player.activateBooster(booster: Booster): Boolean { Bukkit.broadcastMessage(activationMessage) } - for (expiryCommand in booster.activationCommands) { + for (activationCommand in booster.activationCommands) { Bukkit.dispatchCommand( Bukkit.getConsoleSender(), - expiryCommand.replace("%player%", booster.active?.player?.name ?: "") + activationCommand.replace("%player%", this.name ?: "") ) } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/boosters/boosters/Booster.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/boosters/boosters/Booster.kt index abfcb45..830af63 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/boosters/boosters/Booster.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/boosters/boosters/Booster.kt @@ -222,6 +222,27 @@ class Booster( outputString } ) + + PlaceholderManager.registerPlaceholder( + PlayerlessPlaceholder( + plugin, + "active_ids_list", + ) { + var activeList = mutableListOf() + + for (active in Bukkit.getServer().activeBoosters) { + activeList.add(active.booster.getID()) + } + + var outputString = + plugin.langYml.getString("no-currently-active-ids-list").formatEco(formatPlaceholders = false) + if (activeList.size > 0) { + outputString = activeList.joinToString(",") + } + + outputString + } + ) } override fun getID(): String { diff --git a/eco-core/core-plugin/src/main/resources/lang.yml b/eco-core/core-plugin/src/main/resources/lang.yml index 2ffe5ca..8470f42 100644 --- a/eco-core/core-plugin/src/main/resources/lang.yml +++ b/eco-core/core-plugin/src/main/resources/lang.yml @@ -16,4 +16,5 @@ messages: no-currently-active: "&cNot Active!" no-currently-active-list: "&cThere isn't any booster active!" +no-currently-active-ids-list: "None" active-placeholder: "&fThanks %player% &ffor activating %booster%&f!"