summaryrefslogtreewikicommitdiff
path: root/core/src/command/Stop.kt
blob: c0ca4015b81d5139604d4b78da9b91aea808b0bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package cat.freya.khs.command

import cat.freya.khs.Khs
import cat.freya.khs.command.util.Command
import cat.freya.khs.game.Game
import cat.freya.khs.player.Player
import cat.freya.khs.runChecks

class KhsStop : Command {
    override val label = "stop"
    override val usage = listOf<String>()
    override val description = "Stops the game"

    override fun execute(plugin: Khs, player: Player, args: List<String>) {
        runChecks(plugin, player) {
            gameMapExists()
            gameInProgress()
        }

        plugin.game.broadcast(plugin.locale.prefix.abort + plugin.locale.game.stop)
        plugin.game.stop(Game.WinType.NONE)
    }

    override fun autoComplete(plugin: Khs, parameter: String, typed: String): List<String> {
        return listOf()
    }
}