1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-22 01:48: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) {
Class[] params = method.getParameterTypes();
Log.d("命令 %s 参数类型: %s", ci.getName(), Arrays.toString(params));
if (params.length > 0 && params[0].isInstance(CommandSender.class)) {
if (method.getReturnType() == boolean.class) {
try {
Class<? extends CommandSender> sender = params[0];
// 用于消除unuse警告
if (!sender.getName().isEmpty() && method.getReturnType() == boolean.class) {
defCmd = ci;
} else {
cmds.add(ci);
cmdCache.put(ci.getName(), ci);
}
return true;
} catch (ArrayIndexOutOfBoundsException | ClassCastException ignored) {
}
Log.warning(String.format(argumentTypeError, method.getName(), clazz.getClass().getName()));
}