diff options
Diffstat (limited to 'core/src/command/Reload.kt')
| -rw-r--r-- | core/src/command/Reload.kt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/core/src/command/Reload.kt b/core/src/command/Reload.kt new file mode 100644 index 0000000..eee5231 --- /dev/null +++ b/core/src/command/Reload.kt @@ -0,0 +1,33 @@ +package cat.freya.khs.command + +import cat.freya.khs.Khs +import cat.freya.khs.command.util.Command +import cat.freya.khs.player.Player +import cat.freya.khs.runChecks + +class KhsReload : Command { + override val label = "reload" + override val usage = listOf<String>() + override val description = "Reload's the plugin config" + + override fun execute(plugin: Khs, player: Player, args: List<String>) { + runChecks(plugin, player) { + gameNotInProgress() + lobbyEmpty() + } + + player.message(plugin.locale.prefix.default + plugin.locale.command.reloading) + plugin + .reloadConfig() + .onSuccess { + player.message(plugin.locale.prefix.default + plugin.locale.command.reloaded) + } + .onFailure { + player.message(plugin.locale.prefix.default + plugin.locale.command.errorReloading) + } + } + + override fun autoComplete(plugin: Khs, parameter: String, typed: String): List<String> { + return listOf() + } +} |