diff options
| author | Freya Murphy <freya@freyacat.org> | 2026-03-26 23:15:33 -0400 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2026-03-27 23:09:23 -0400 |
| commit | f8322cd21cde68a72b05efbad3a05b8e67c0bdd0 (patch) | |
| tree | d7e60bc8fedadc8fa7ae725571cad1f398eaf6dc /core/src/command/Start.kt | |
| download | kenshinshideandseek2-f8322cd21cde68a72b05efbad3a05b8e67c0bdd0.tar.gz kenshinshideandseek2-f8322cd21cde68a72b05efbad3a05b8e67c0bdd0.tar.bz2 kenshinshideandseek2-f8322cd21cde68a72b05efbad3a05b8e67c0bdd0.zip | |
initial
Diffstat (limited to 'core/src/command/Start.kt')
| -rw-r--r-- | core/src/command/Start.kt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/core/src/command/Start.kt b/core/src/command/Start.kt new file mode 100644 index 0000000..e24c505 --- /dev/null +++ b/core/src/command/Start.kt @@ -0,0 +1,34 @@ +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 KhsStart : Command { + override val label = "start" + override val usage = listOf("*seekers...") + override val description = + "Starts the game either with a random set of seekers or a chosen list" + + override fun execute(plugin: Khs, player: Player, args: List<String>) { + runChecks(plugin, player) { + gameMapExists() + gameNotInProgress() + playerInGame() + lobbyHasEnoughPlayers() + } + + val pool = + args + .map { plugin.shim.getPlayer(it)?.uuid } + .filterNotNull() + .filter { plugin.game.hasPlayer(it) } + + plugin.game.start(pool) + } + + override fun autoComplete(plugin: Khs, parameter: String, typed: String): List<String> { + return plugin.game.players.map(Player::name) + } +} |