1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-22 01:48:50 +00:00

feat: 命令添加多重注册

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-07-26 08:07:18 +08:00
parent aa324f54db
commit bf4c508bc5

View File

@ -83,7 +83,7 @@ public class CommandManager implements TabExecutor {
* @param executor
* 命令执行类
*/
public CommandManager(final String name, final CommandExecutor executor) {
public CommandManager(final String name, final CommandExecutor... executor) {
this(name);
register(executor);
}
@ -126,7 +126,8 @@ public class CommandManager implements TabExecutor {
* @param clazz
* 子命令处理类
*/
public void register(final CommandExecutor clazz) {
public void register(final CommandExecutor... clazzs) {
for (final CommandExecutor clazz : clazzs) {
final Method[] methods = clazz.getClass().getDeclaredMethods();
for (final Method method : methods) {
if (registerCommand(method, clazz)) {
@ -134,6 +135,7 @@ public class CommandManager implements TabExecutor {
}
registerTab(method, clazz);
}
}
help = new CommandHelp(cmds);
buildCmdNameCache();
}