diff options
Diffstat (limited to 'core/src/command/map')
| -rw-r--r-- | core/src/command/map/blockhunt/Disguise.kt | 31 | ||||
| -rw-r--r-- | core/src/command/map/blockhunt/block/Add.kt | 2 |
2 files changed, 32 insertions, 1 deletions
diff --git a/core/src/command/map/blockhunt/Disguise.kt b/core/src/command/map/blockhunt/Disguise.kt new file mode 100644 index 0000000..8ee715a --- /dev/null +++ b/core/src/command/map/blockhunt/Disguise.kt @@ -0,0 +1,31 @@ +package cat.freya.khs.command.map.blockhunt.block + +import cat.freya.khs.Khs +import cat.freya.khs.command.util.Command +import cat.freya.khs.player.Player +import cat.freya.khs.runChecks + +class KhsMapBlockHuntDisguise : Command { + override val label = "disguise" + override val usage = listOf("block") + override val description = "Disguise oneself as any block" + + override fun execute(plugin: Khs, player: Player, args: List<String>) { + val (blockName) = args + runChecks(plugin, player) { blockHuntSupported() } + + val material = plugin.shim.parseMaterial(blockName) + if (material == null) { + player.message(plugin.locale.prefix.error + plugin.locale.blockHunt.block.unknown) + return + } + + player.disguise(material) + } + + override fun autoComplete(plugin: Khs, parameter: String, typed: String): List<String> = + when (parameter) { + "block" -> plugin.shim.blocks.filter { it.startsWith(typed) } + else -> listOf() + } +} diff --git a/core/src/command/map/blockhunt/block/Add.kt b/core/src/command/map/blockhunt/block/Add.kt index 6ed17be..c39cee9 100644 --- a/core/src/command/map/blockhunt/block/Add.kt +++ b/core/src/command/map/blockhunt/block/Add.kt @@ -49,7 +49,7 @@ class KhsMapBlockHuntBlockAdd : Command { .filter { it.value.config.blockHunt.enabled } .map { it.key } .filter { it.startsWith(typed) } - "block" -> listOf(parameter) + "block" -> plugin.shim.blocks.filter { it.startsWith(typed) } else -> listOf() } } |