blob: 87e7b85deb0a51a859e225f093411ad64e3d984d (
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
36
37
38
39
|
package cat.freya.khs.command.map.unset
import cat.freya.khs.Khs
import cat.freya.khs.command.util.Command
import cat.freya.khs.player.Player
import cat.freya.khs.runChecks
class KhsMapUnsetBorder : Command {
override val label = "border"
override val usage = listOf("map")
override val description = "Disable the world border for a map"
override fun execute(plugin: Khs, player: Player, args: List<String>) {
val (name) = args
runChecks(plugin, player) {
mapExists(name)
gameNotInProgress()
}
var map = plugin.maps.get(name) ?: return
val config = map.config.worldBorder
config.enabled = false
config.pos = null
config.size = null
config.delay = null
config.move = null
plugin.saveConfig()
player.message(plugin.locale.prefix.default + plugin.locale.worldBorder.disable)
map.world?.border?.move(0.0, 0.0, 30_000_000UL, 0UL)
}
override fun autoComplete(plugin: Khs, parameter: String, typed: String): List<String> =
when (parameter) {
"map" -> plugin.maps.keys.filter { it.startsWith(typed) }
else -> listOf()
}
}
|