Tweaks
This commit is contained in:
@@ -5,50 +5,51 @@ import io.dico.dicore.command.ICommandAddress
|
||||
import io.dico.dicore.command.ICommandDispatcher
|
||||
import io.dico.dicore.command.registration.reflect.ReflectiveRegistration
|
||||
import io.dico.parcels2.ParcelsPlugin
|
||||
import io.dico.parcels2.logger
|
||||
import java.util.LinkedList
|
||||
import java.util.Queue
|
||||
|
||||
@Suppress("UsePropertyAccessSyntax")
|
||||
fun getParcelCommands(plugin: ParcelsPlugin): ICommandDispatcher {
|
||||
//@formatter:off
|
||||
return CommandBuilder()
|
||||
.setChatController(ParcelsChatController())
|
||||
.addParameterType(false, ParcelParameterType(plugin.parcelProvider))
|
||||
.addParameterType(true, ParcelTarget.PType(plugin.parcelProvider))
|
||||
fun getParcelCommands(plugin: ParcelsPlugin): ICommandDispatcher =
|
||||
with(CommandBuilder()) {
|
||||
setChatController(ParcelsChatController())
|
||||
addParameterType(false, ParcelParameterType(plugin.parcelProvider))
|
||||
addParameterType(false, ProfileParameterType())
|
||||
addParameterType(true, ParcelTarget.PType(plugin.parcelProvider))
|
||||
|
||||
.group("parcel", "plot", "plots", "p")
|
||||
.addRequiredPermission("parcels.command")
|
||||
.registerCommands(CommandsGeneral(plugin))
|
||||
.registerCommands(CommandsAddedStatusLocal(plugin))
|
||||
group("parcel", "plot", "plots", "p") {
|
||||
addRequiredPermission("parcels.command")
|
||||
registerCommands(CommandsGeneral(plugin))
|
||||
registerCommands(CommandsAddedStatusLocal(plugin))
|
||||
|
||||
.group("option", "opt", "o")
|
||||
.apply { CommandsParcelOptions.setGroupDescription(this) }
|
||||
.registerCommands(CommandsParcelOptions(plugin))
|
||||
.parent()
|
||||
group("option", "opt", "o") {
|
||||
CommandsParcelOptions.setGroupDescription(this)
|
||||
registerCommands(CommandsParcelOptions(plugin))
|
||||
}
|
||||
|
||||
.group("global", "g")
|
||||
.registerCommands(CommandsAddedStatusGlobal(plugin))
|
||||
.parent()
|
||||
group("global", "g") {
|
||||
registerCommands(CommandsAddedStatusGlobal(plugin))
|
||||
}
|
||||
|
||||
.group("admin", "a")
|
||||
.registerCommands(CommandsAdmin(plugin))
|
||||
.parent()
|
||||
group("admin", "a") {
|
||||
registerCommands(CommandsAdmin(plugin))
|
||||
}
|
||||
|
||||
.putDebugCommands(plugin)
|
||||
if (!logger.isDebugEnabled) return@group
|
||||
|
||||
.parent()
|
||||
.generateHelpAndSyntaxCommands()
|
||||
.getDispatcher()
|
||||
//@formatter:on
|
||||
}
|
||||
group("debug", "d") {
|
||||
registerCommands(CommandsDebug(plugin))
|
||||
}
|
||||
}
|
||||
|
||||
private fun CommandBuilder.putDebugCommands(plugin: ParcelsPlugin): CommandBuilder {
|
||||
//if (!logger.isDebugEnabled) return this
|
||||
//@formatter:off
|
||||
return group("debug", "d")
|
||||
.registerCommands(CommandsDebug(plugin))
|
||||
.parent()
|
||||
//@formatter:on
|
||||
generateHelpAndSyntaxCommands()
|
||||
getDispatcher()
|
||||
}
|
||||
|
||||
inline fun CommandBuilder.group(name: String, vararg aliases: String, config: CommandBuilder.() -> Unit) {
|
||||
group(name, *aliases)
|
||||
config()
|
||||
parent()
|
||||
}
|
||||
|
||||
private fun CommandBuilder.generateHelpAndSyntaxCommands(): CommandBuilder {
|
||||
|
||||
Reference in New Issue
Block a user