Skip to content

Commit

Permalink
Patch CommandScriptHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
Morphan1 committed Jul 18, 2018
1 parent ec10b35 commit 0590fbe
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -42,7 +42,17 @@ public CommandScriptHelper() {
CommandMap commandMap = (CommandMap) commandMapField.get(server);

// Get the knownCommands for the server's CommandMap
final Field knownCommandsField = commandMap.getClass().getDeclaredField("knownCommands");
Field kcf = null;
Class commandMapClass = commandMap.getClass();
while (kcf == null && commandMapClass != Object.class) {
try {
kcf = commandMapClass.getDeclaredField("knownCommands");
}
catch (NoSuchFieldException e) {
commandMapClass = commandMapClass.getSuperclass();
}
}
final Field knownCommandsField = kcf;
knownCommandsField.setAccessible(true);
knownCommands = (Map<String, Command>) knownCommandsField.get(commandMap);

Expand Down

0 comments on commit 0590fbe

Please sign in to comment.