for (Method method : commands.getClass().getDeclaredMethods())
{
AutoRefCommand command = method.getAnnotation(AutoRefCommand.class);
if (command == null || command.name().length == 0) continue;
PluginCommand pcommand = plugin.getCommand(command.name()[0]);
if (pcommand == null) throw new CommandRegistrationException(method, "Command not provided in plugin.yml");
if (method.getReturnType() != boolean.class)
throw new CommandRegistrationException(method, "Command method must return type boolean");
if (pcommand.getExecutor() != this) pcommand.setExecutor(this);
if (pcommand.getTabCompleter() != this) pcommand.setTabCompleter(this);
CommandDelegator delegator = new CommandDelegator(commands, method, pcommand);
this.setHandler(delegator, command.name());
}
}