1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-25 02:18:50 +00:00

fix: 修复之前错误的检测逻辑

This commit is contained in:
502647092 2016-10-24 00:34:45 +08:00
parent 17c75d923e
commit 551022cf26

View File

@ -272,14 +272,17 @@ public class CommandManager implements TabExecutor {
if (ci != null) { if (ci != null) {
Class[] params = method.getParameterTypes(); Class[] params = method.getParameterTypes();
Log.d("命令 %s 参数类型: %s", ci.getName(), Arrays.toString(params)); Log.d("命令 %s 参数类型: %s", ci.getName(), Arrays.toString(params));
if (params.length > 0 && params[0].isInstance(CommandSender.class)) { try {
if (method.getReturnType() == boolean.class) { Class<? extends CommandSender> sender = params[0];
// 用于消除unuse警告
if (!sender.getName().isEmpty() && method.getReturnType() == boolean.class) {
defCmd = ci; defCmd = ci;
} else { } else {
cmds.add(ci); cmds.add(ci);
cmdCache.put(ci.getName(), ci); cmdCache.put(ci.getName(), ci);
} }
return true; return true;
} catch (ArrayIndexOutOfBoundsException | ClassCastException ignored) {
} }
Log.warning(String.format(argumentTypeError, method.getName(), clazz.getClass().getName())); Log.warning(String.format(argumentTypeError, method.getName(), clazz.getClass().getName()));
} }