1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-12-26 07:18:52 +00:00

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

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2019-10-26 17:57:39 +08:00
parent be1ad18954
commit f7b67e724d

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);