fix: 修复新版本命令注册失败的问题

Signed-off-by: MiaoWoo <admin@yumc.pw>
merge/16/MERGE
MiaoWoo 2019-10-26 17:57:39 +08:00
parent be1ad18954
commit f7b67e724d
1 changed files with 2 additions and 3 deletions

View File

@ -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<String, Command>) knownCommandsField.get(commandMap);
knownCommands = Reflect.on(commandMap).field("knownCommands").get();
PluginCommandConstructor = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
PluginCommandConstructor.setAccessible(true);