From f7b67e724dd6c4b2b7d73020aafbea6349e19453 Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Sat, 26 Oct 2019 17:57:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=91=BD=E4=BB=A4=E6=B3=A8=E5=86=8C=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MiaoWoo --- src/main/java/pw/yumc/YumCore/commands/CommandKit.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/pw/yumc/YumCore/commands/CommandKit.java b/src/main/java/pw/yumc/YumCore/commands/CommandKit.java index 3e3729a..ff0240b 100644 --- a/src/main/java/pw/yumc/YumCore/commands/CommandKit.java +++ b/src/main/java/pw/yumc/YumCore/commands/CommandKit.java @@ -15,6 +15,7 @@ import org.bukkit.plugin.java.JavaPlugin; import pw.yumc.YumCore.bukkit.Log; import pw.yumc.YumCore.bukkit.P; +import pw.yumc.YumCore.reflect.Reflect; /** * 命令工具类 @@ -38,9 +39,7 @@ public class CommandKit { commandMapField.setAccessible(true); SimpleCommandMap commandMap = (SimpleCommandMap) commandMapField.get(pluginManager); - Field knownCommandsField = commandMap.getClass().getDeclaredField("knownCommands"); - knownCommandsField.setAccessible(true); - knownCommands = (Map) knownCommandsField.get(commandMap); + knownCommands = Reflect.on(commandMap).field("knownCommands").get(); PluginCommandConstructor = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class); PluginCommandConstructor.setAccessible(true);