summaryrefslogtreewikicommitdiff
path: root/core/src/command/map/unset
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2026-03-26 23:15:33 -0400
committerFreya Murphy <freya@freyacat.org>2026-03-27 23:09:23 -0400
commitf8322cd21cde68a72b05efbad3a05b8e67c0bdd0 (patch)
treed7e60bc8fedadc8fa7ae725571cad1f398eaf6dc /core/src/command/map/unset
downloadkenshinshideandseek2-f8322cd21cde68a72b05efbad3a05b8e67c0bdd0.tar.gz
kenshinshideandseek2-f8322cd21cde68a72b05efbad3a05b8e67c0bdd0.tar.bz2
kenshinshideandseek2-f8322cd21cde68a72b05efbad3a05b8e67c0bdd0.zip
initial
Diffstat (limited to 'core/src/command/map/unset')
-rw-r--r--core/src/command/map/unset/Border.kt39
1 files changed, 39 insertions, 0 deletions
diff --git a/core/src/command/map/unset/Border.kt b/core/src/command/map/unset/Border.kt
new file mode 100644
index 0000000..87e7b85
--- /dev/null
+++ b/core/src/command/map/unset/Border.kt
@@ -0,0 +1,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()
+ }
+}