Archived
0

Work on some commands

This commit is contained in:
Dico200
2018-07-27 18:29:00 +01:00
parent cb3fb4771a
commit a9c19ff5cf
7 changed files with 181 additions and 33 deletions

View File

@@ -3,7 +3,7 @@ package io.dico.parcels2.command
import io.dico.dicore.command.CommandBuilder
import io.dico.dicore.command.ICommandDispatcher
import io.dico.parcels2.ParcelsPlugin
import io.dico.parcels2.debugging
import io.dico.parcels2.logger
@Suppress("UsePropertyAccessSyntax")
fun getParcelCommands(plugin: ParcelsPlugin): ICommandDispatcher {
@@ -11,16 +11,25 @@ fun getParcelCommands(plugin: ParcelsPlugin): ICommandDispatcher {
return CommandBuilder()
.addParameterType(false, ParcelParameterType(plugin.worlds))
.addParameterType(true, ParcelHomeParameterType(plugin.worlds))
.group("parcel", "plot", "plots", "p")
.registerCommands(ParcelCommands(plugin))
.registerCommands(ParcelAddCommands(plugin))
.group("option")
.apply { ParcelOptionCommands.setGroupDescription(this) }
.registerCommands(ParcelOptionCommands(plugin))
.parent()
.putDebugCommands(plugin)
.parent()
.getDispatcher()
//@formatter:on
}
private fun CommandBuilder.putDebugCommands(plugin: ParcelsPlugin): CommandBuilder {
if (!debugging) return this
if (!logger.isDebugEnabled) return this
//@formatter:off
return group("debug", "d")
.registerCommands(DebugCommands(plugin))