summaryrefslogtreewikicommitdiff
path: root/core/src/command/map/List.kt
blob: 8bc7a817201a94eadcef8ba8060af700ffe0e9b5 (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
28
29
30
31
32
package cat.freya.khs.command.map

import cat.freya.khs.Khs
import cat.freya.khs.command.util.Command
import cat.freya.khs.player.Player

class KhsMapList : Command {
    override val label = "list"
    override val usage = listOf<String>()
    override val description = "List maps known to the plugin"

    override fun execute(plugin: Khs, player: Player, args: List<String>) {
        if (plugin.maps.isEmpty()) {
            player.message(plugin.locale.prefix.default + plugin.locale.map.none)
            return
        }

        player.message(
            buildString {
                appendLine(plugin.locale.prefix.default + plugin.locale.map.list)
                for ((name, map) in plugin.maps) {
                    append("&e- &f$name: ")
                    appendLine(if (map.setup) "&aSETUP" else "&cNOT SETUP")
                }
            }
        )
    }

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