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