From e2bd1bdd098748aca86b48ac75a017b71d887966 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Thu, 19 May 2016 00:33:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dfind=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E7=9B=B8=E5=85=B3BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/pw/yumc/Yum/commands/YumCommand.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/pw/yumc/Yum/commands/YumCommand.java b/src/main/java/pw/yumc/Yum/commands/YumCommand.java index a1fa154..3381cc2 100644 --- a/src/main/java/pw/yumc/Yum/commands/YumCommand.java +++ b/src/main/java/pw/yumc/Yum/commands/YumCommand.java @@ -74,12 +74,12 @@ public class YumCommand implements HandlerCommands, Listener { final CommandSender sender = e.getSender(); try { final Class clazz = Class.forName(classname); - final Field field = clazz.getClass().getDeclaredField("plugin"); + final Field field = clazz.getClassLoader().getClass().getDeclaredField("plugin"); field.setAccessible(true); - final Plugin plugin = (JavaPlugin) field.get(clazz); + final Plugin plugin = (JavaPlugin) field.get(clazz.getClassLoader()); Bukkit.dispatchCommand(sender, "yum info " + plugin.getName()); } catch (final ClassNotFoundException | NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e2) { - sender.sendMessage("§4错误: 无法找到类 " + classname + " 所对应的插件信息!"); + sender.sendMessage("§4错误: 无法找到类 " + classname + " 所对应的插件信息 异常:" + e2.getClass().getSimpleName() + " " + e2.getMessage() + "!"); } }