Refactor and reformat commands
This commit is contained in:
26
src/main/kotlin/io/dico/parcels2/command/CommandsDebug.kt
Normal file
26
src/main/kotlin/io/dico/parcels2/command/CommandsDebug.kt
Normal 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"
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user