From 69d9faea9ec0335582111a6109040f0da76edb45 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Mon, 12 Dec 2016 17:51:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- .../java/pw/yumc/YumCore/commands/CommandSub.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/pw/yumc/YumCore/commands/CommandSub.java b/src/main/java/pw/yumc/YumCore/commands/CommandSub.java index 988ef73..827cdc8 100644 --- a/src/main/java/pw/yumc/YumCore/commands/CommandSub.java +++ b/src/main/java/pw/yumc/YumCore/commands/CommandSub.java @@ -1,5 +1,8 @@ package pw.yumc.YumCore.commands; +import java.lang.reflect.Method; +import java.util.*; + import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.PluginCommand; @@ -7,6 +10,7 @@ import org.bukkit.command.TabExecutor; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.StringUtil; + import pw.yumc.YumCore.bukkit.Log; import pw.yumc.YumCore.bukkit.P; import pw.yumc.YumCore.bukkit.compatible.C; @@ -18,9 +22,6 @@ import pw.yumc.YumCore.commands.interfaces.Executor; import pw.yumc.YumCore.commands.interfaces.HelpGenerator; import pw.yumc.YumCore.commands.interfaces.HelpParse; -import java.lang.reflect.Method; -import java.util.*; - /** * 子命令管理类 * @@ -79,6 +80,7 @@ public class CommandSub implements TabExecutor { if (cmd == null) { if ((cmd = CommandKit.create(name)) == null) { throw new IllegalStateException("未找到命令 必须在plugin.yml先注册 " + name + " 命令!"); } } + Log.d("初始化命令: %s", name); cmd.setExecutor(this); cmd.setTabCompleter(this); } @@ -216,6 +218,7 @@ public class CommandSub implements TabExecutor { */ public CommandSub register(Executor... clazzs) { for (Executor clazz : clazzs) { + Log.d("解析执行类: %s", clazz.getClass().getName()); Method[] methods = clazz.getClass().getDeclaredMethods(); for (Method method : methods) { if (registerCommand(method, clazz)) { @@ -242,7 +245,7 @@ public class CommandSub implements TabExecutor { CommandInfo ci = CommandInfo.parse(method, clazz); if (ci != null) { Class[] params = method.getParameterTypes(); - Log.d("注册命令 %s 参数类型: %s", ci.getName(), Arrays.toString(params)); + Log.d("注册子命令: %s 参数类型: %s", ci.getName(), Arrays.toString(params)); try { Class sender = params[0]; // 用于消除unuse警告 @@ -273,6 +276,7 @@ public class CommandSub implements TabExecutor { CommandTabInfo ti = CommandTabInfo.parse(method, clazz); if (ti != null) { if (method.getReturnType().equals(List.class)) { + Log.d("注册命令补全: %s ", method.getName()); tabs.add(ti); return true; }