feat: 命令添加多重注册

Signed-off-by: 502647092 <admin@yumc.pw>
merge/1/MERGE
502647092 2016-07-26 08:07:18 +08:00
parent aa324f54db
commit bf4c508bc5
1 changed files with 9 additions and 7 deletions

View File

@ -83,7 +83,7 @@ public class CommandManager implements TabExecutor {
* @param executor * @param executor
* *
*/ */
public CommandManager(final String name, final CommandExecutor executor) { public CommandManager(final String name, final CommandExecutor... executor) {
this(name); this(name);
register(executor); register(executor);
} }
@ -126,13 +126,15 @@ public class CommandManager implements TabExecutor {
* @param clazz * @param clazz
* *
*/ */
public void register(final CommandExecutor clazz) { public void register(final CommandExecutor... clazzs) {
final Method[] methods = clazz.getClass().getDeclaredMethods(); for (final CommandExecutor clazz : clazzs) {
for (final Method method : methods) { final Method[] methods = clazz.getClass().getDeclaredMethods();
if (registerCommand(method, clazz)) { for (final Method method : methods) {
continue; if (registerCommand(method, clazz)) {
continue;
}
registerTab(method, clazz);
} }
registerTab(method, clazz);
} }
help = new CommandHelp(cmds); help = new CommandHelp(cmds);
buildCmdNameCache(); buildCmdNameCache();