Search in sources :

Example 1 with AliasesTabCompleter

use of com.Ben12345rocks.VotingPlugin.Commands.TabCompleter.AliasesTabCompleter 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());
                }
            }
        }
    }
}
Also used : CommandAliases(com.Ben12345rocks.VotingPlugin.Commands.Executers.CommandAliases) CommandHandler(com.Ben12345rocks.AdvancedCore.Objects.CommandHandler) AliasesTabCompleter(com.Ben12345rocks.VotingPlugin.Commands.TabCompleter.AliasesTabCompleter)

Aggregations

CommandHandler (com.Ben12345rocks.AdvancedCore.Objects.CommandHandler)1 CommandAliases (com.Ben12345rocks.VotingPlugin.Commands.Executers.CommandAliases)1 AliasesTabCompleter (com.Ben12345rocks.VotingPlugin.Commands.TabCompleter.AliasesTabCompleter)1