blob: af48f03f47917377d60712716e64b057896e6d61 (
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
40
41
42
|
package cat.freya.khs.command.world
import cat.freya.khs.Khs
import cat.freya.khs.command.util.Command
import cat.freya.khs.player.Player
import cat.freya.khs.world.World
class KhsWorldList : Command {
override val label = "list"
override val usage = listOf<String>()
override val description = "Teleport to a world's spawn"
override fun execute(plugin: Khs, player: Player, args: List<String>) {
val worlds = plugin.shim.worlds
if (worlds.isEmpty()) {
// uhhh, we have to be in a world to call this 0_0
player.message(plugin.locale.prefix.error + plugin.locale.world.none)
return
}
val message = buildString {
appendLine(plugin.locale.world.list)
for (worldName in worlds) {
val world = plugin.shim.getWorld(worldName)
val status =
when (world?.type) {
World.Type.NORMAL -> "&aNORMAL"
World.Type.FLAT -> "&aFLAT"
World.Type.NETHER -> "&cNETHER"
World.Type.END -> "&eEND"
else -> "&7NOT LOADED"
}
appendLine("&e- &f$worldName: $status")
}
}
player.message(message)
}
override fun autoComplete(plugin: Khs, parameter: String, typed: String): List<String> {
return listOf()
}
}
|