use of com.Ben12345rocks.VotingPlugin.Commands.Executers.CommandAliases in project VotingPlugin by Ben12345rocks.
the class CommandLoader method loadAliases.
/**
* Load aliases.
*/
public void loadAliases() {
commands = new HashMap<String, CommandHandler>();
for (CommandHandler cmdHandle : plugin.voteCommand) {
if (cmdHandle.getArgs().length > 0) {
String[] args = cmdHandle.getArgs()[0].split("&");
for (String arg : args) {
try {
plugin.getCommand("vote" + arg).setExecutor(new CommandAliases(cmdHandle, false));
plugin.getCommand("vote" + arg).setTabCompleter(new AliasesTabCompleter().setCMDHandle(cmdHandle, false));
} catch (Exception ex) {
plugin.debug("Failed to load command and tab completer for /vote" + arg);
}
}
}
}
for (CommandHandler cmdHandle : plugin.adminVoteCommand) {
if (cmdHandle.getArgs().length > 0) {
String[] args = cmdHandle.getArgs()[0].split("&");
for (String arg : args) {
try {
plugin.getCommand("adminvote" + arg).setExecutor(new CommandAliases(cmdHandle, true));
plugin.getCommand("adminvote" + arg).setTabCompleter(new AliasesTabCompleter().setCMDHandle(cmdHandle, true));
} catch (Exception ex) {
plugin.debug("Failed to load command and tab completer for /adminvote" + arg + ": " + ex.getMessage());
}
}
}
}
}
Aggregations