Archived
0

Refactor and reformat commands

This commit is contained in:
Dico200
2018-07-27 23:31:24 +01:00
parent 2a726e1b61
commit 2c1aee89f6
12 changed files with 94 additions and 104 deletions

View File

@@ -0,0 +1,26 @@
package io.dico.parcels2.command
import io.dico.dicore.command.CommandException
import io.dico.dicore.command.annotation.Cmd
import io.dico.parcels2.ParcelsPlugin
import org.bukkit.Bukkit
import org.bukkit.entity.Player
class CommandsDebug(val plugin: ParcelsPlugin) {
@Cmd("reloadoptions")
fun reloadOptions() {
plugin.loadOptions()
}
@Cmd("tpworld")
fun tpWorld(sender: Player, worldName: String): String {
if (worldName == "list") {
return Bukkit.getWorlds().joinToString("\n- ", "- ", "")
}
val world = Bukkit.getWorld(worldName) ?: throw CommandException("World $worldName is not loaded")
sender.teleport(world.spawnLocation)
return "Teleported you to $worldName spawn"
}
}