The server config can now specify aliases to multiple (or none) commands, for example "debug: [version, plugin]" to run both version and plugin, or "plugins: []" to disable the plugins command

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot
2011-06-22 19:07:07 +01:00
parent 22bfa512a9
commit 244635242e
3 changed files with 51 additions and 8 deletions

View File

@@ -0,0 +1,25 @@
package org.bukkit.command;
/**
* Represents a command that delegates to one or more other commands
*/
public class MultipleCommandAlias extends Command {
private Command[] commands;
public MultipleCommandAlias(String name, Command[] commands) {
super(name);
this.commands = commands;
}
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
boolean result = false;
for (Command command : commands) {
result |= command.execute(sender, commandLabel, args);
}
return result;
}
}