Added activation/expiry commands
This commit is contained in:
@@ -52,6 +52,13 @@ fun Player.activateBooster(booster: Booster): Boolean {
|
||||
Bukkit.broadcastMessage(activationMessage)
|
||||
}
|
||||
|
||||
for (expiryCommand in booster.activationCommands) {
|
||||
Bukkit.dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
expiryCommand.replace("%player%", booster.active?.player?.name ?: "")
|
||||
)
|
||||
}
|
||||
|
||||
ServerProfile.load().write(
|
||||
booster.expiryTimeKey,
|
||||
(booster.duration.toDouble() * 50) + System.currentTimeMillis()
|
||||
|
||||
@@ -36,6 +36,13 @@ class BoostersPlugin : LibReforgePlugin(2036, 14269, "&e") {
|
||||
Bukkit.broadcastMessage(expiryMessage)
|
||||
}
|
||||
|
||||
for (expiryCommand in booster.expiryMessages) {
|
||||
Bukkit.dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
expiryCommand.replace("%player%", booster.active?.player?.name ?: "")
|
||||
)
|
||||
}
|
||||
|
||||
Bukkit.getServer().expireBooster(booster)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,10 @@ class Booster(
|
||||
|
||||
val expiryMessages: List<String> = config.getFormattedStrings("messages.expiry")
|
||||
|
||||
val activationCommands: List<String> = config.getFormattedStrings("commands.activation")
|
||||
|
||||
val expiryCommands: List<String> = config.getFormattedStrings("commands.expiry")
|
||||
|
||||
fun getGuiItem(player: Player): ItemStack {
|
||||
return ItemStackBuilder(Items.lookup(config.getString("gui.item")))
|
||||
.setDisplayName(config.getFormattedString("gui.name"))
|
||||
|
||||
@@ -7,6 +7,9 @@ boosters:
|
||||
args:
|
||||
multiplier: 1.5
|
||||
conditions: []
|
||||
commands:
|
||||
activation: []
|
||||
expiry: []
|
||||
messages:
|
||||
activation:
|
||||
- ""
|
||||
@@ -45,6 +48,9 @@ boosters:
|
||||
args:
|
||||
multiplier: 2
|
||||
conditions: []
|
||||
commands:
|
||||
activation: []
|
||||
expiry: []
|
||||
messages:
|
||||
activation:
|
||||
- ""
|
||||
@@ -83,6 +89,9 @@ boosters:
|
||||
args:
|
||||
multiplier: 2
|
||||
conditions: []
|
||||
commands:
|
||||
activation: []
|
||||
expiry: []
|
||||
messages:
|
||||
activation:
|
||||
- ""
|
||||
|
||||
Reference in New Issue
Block a user