blob: 0620e3d6a8430e9a88a581d8d6e1a72c4e05b17e (
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
33
34
35
|
package cat.freya.khs.command.map.blockhunt
import cat.freya.khs.Khs
import cat.freya.khs.command.util.Command
import cat.freya.khs.inv.createBlockHuntPicker
import cat.freya.khs.player.Player
import cat.freya.khs.runChecks
class KhsMapBlockHuntDebug : Command {
override val label = "debug"
override val usage = listOf("map")
override val description = "Manually open the blockhunt picker for a map"
override fun execute(plugin: Khs, player: Player, args: List<String>) {
val (name) = args
runChecks(plugin, player) {
blockHuntSupported()
blockHuntEnabled(name)
}
val map = plugin.maps.get(name) ?: return
val inv = createBlockHuntPicker(plugin, map) ?: return
player.showInventory(inv)
}
override fun autoComplete(plugin: Khs, parameter: String, typed: String): List<String> =
when (parameter) {
"map" ->
plugin.maps
.filter { it.value.config.blockHunt.enabled }
.map { it.key }
.filter { it.startsWith(typed) }
else -> listOf()
}
}
|