HarryPotterSpells

HarryPotterSpells

59.3k Downloads

Update command registration to use commandMap reflection on `getServer()` instead of CraftBukkit Server

jacklin213 opened this issue ยท 1 comments

commented

Replace the following code:

// Hacky command map stuff
try {
Class<?> craftServer = SVPBypass.getCurrentCBClass("CraftServer");
if (craftServer == null)
throw new Throwable("Computer says no");
Field f = craftServer.getDeclaredField("commandMap");
f.setAccessible(true);
commandMap = (CommandMap) f.get(getServer());
} catch (Throwable e) {
PM.log(Level.SEVERE, Localisation.getTranslation("errCommandMap"));
PM.debug(e);
}

With some non NMS alternative