mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-08-28 08:25:56 +02:00
replace gui to config subcommand
This commit is contained in:
parent
d67d998dc1
commit
3b708302bc
2 changed files with 11 additions and 2 deletions
|
|
@ -20,6 +20,7 @@ class CustomAnvilCommand(plugin: CustomAnvil) : CommandExecutor, TabCompleter {
|
||||||
private val helpCommand = HelpExecutor()
|
private val helpCommand = HelpExecutor()
|
||||||
private val commands = ImmutableMap.of(
|
private val commands = ImmutableMap.of(
|
||||||
"gui", editConfigCommand,
|
"gui", editConfigCommand,
|
||||||
|
"config", editConfigCommand,
|
||||||
"reload", ReloadExecutor(),
|
"reload", ReloadExecutor(),
|
||||||
"diagnostic", DiagnosticExecutor(),
|
"diagnostic", DiagnosticExecutor(),
|
||||||
"debug", DebugToggleExecutor(),
|
"debug", DebugToggleExecutor(),
|
||||||
|
|
@ -42,12 +43,16 @@ class CustomAnvilCommand(plugin: CustomAnvil) : CommandExecutor, TabCompleter {
|
||||||
): Boolean {
|
): Boolean {
|
||||||
// Find sub command to execute based on the provided command name
|
// Find sub command to execute based on the provided command name
|
||||||
val subcmd: CASubCommand?
|
val subcmd: CASubCommand?
|
||||||
|
val subcmdStr: String
|
||||||
|
|
||||||
val newargs: Array<out String>
|
val newargs: Array<out String>
|
||||||
if(args.isEmpty()) {
|
if(args.isEmpty()) {
|
||||||
|
subcmdStr = "config"
|
||||||
subcmd = editConfigCommand
|
subcmd = editConfigCommand
|
||||||
newargs = args
|
newargs = args
|
||||||
}else {
|
}else {
|
||||||
subcmd = commands[args[0].lowercase()]
|
subcmdStr = args[0].lowercase()
|
||||||
|
subcmd = commands[subcmdStr]
|
||||||
newargs = args.copyOfRange(1, args.size)
|
newargs = args.copyOfRange(1, args.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,7 +62,7 @@ class CustomAnvilCommand(plugin: CustomAnvil) : CommandExecutor, TabCompleter {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return subcmd.executeCommand(sender, cmd, cmdstr, newargs)
|
return subcmd.executeCommand(sender, cmd, subcmdStr, newargs)
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
MetricsUtil.trackError(e)
|
MetricsUtil.trackError(e)
|
||||||
sender.sendMessage("§cError running this command")
|
sender.sendMessage("§cError running this command")
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,10 @@ class EditConfigExecutor: CASubCommand() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ("gui".equals(cmdstr, ignoreCase = true)) {
|
||||||
|
sender.sendMessage("§c/ca gui has been moved to /ca config")
|
||||||
|
}
|
||||||
|
|
||||||
MainConfigGui.getInstance().show(sender)
|
MainConfigGui.getInstance().show(sender)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue