From f8322cd21cde68a72b05efbad3a05b8e67c0bdd0 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Thu, 26 Mar 2026 23:15:33 -0400 Subject: initial --- core/src/command/Send.kt | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 core/src/command/Send.kt (limited to 'core/src/command/Send.kt') diff --git a/core/src/command/Send.kt b/core/src/command/Send.kt new file mode 100644 index 0000000..bca4467 --- /dev/null +++ b/core/src/command/Send.kt @@ -0,0 +1,30 @@ +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 KhsSend : Command { + override val label = "send" + override val usage = listOf("map") + override val description = "Send the current lobby to another map" + + override fun execute(plugin: Khs, player: Player, args: List) { + val map = plugin.maps.get(args.first()) + + runChecks(plugin, player) { + gameNotInProgress() + playerInGame() + mapSetup(map) + } + + plugin.game.setMap(map) + } + + override fun autoComplete(plugin: Khs, parameter: String, typed: String): List = + when (parameter) { + "map" -> plugin.maps.keys.filter { it.startsWith(typed) } + else -> listOf() + } +} -- cgit v1.2.3-freya