Skip to content

Instantly share code, notes, and snippets.

@vemacs
Last active April 9, 2016 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vemacs/1d8df3d93e86b8fdfb431209313f44b0 to your computer and use it in GitHub Desktop.
Save vemacs/1d8df3d93e86b8fdfb431209313f44b0 to your computer and use it in GitHub Desktop.
private static Method getCommandMap;
public static CommandMap getCommandMap(Server server) {
try {
if (getCommandMap == null) {
getCommandMap = server.getClass().getDeclaredMethod("getCommandMap");
getCommandMap.setAccessible(true);
}
return (CommandMap) getCommandMap.invoke(server);
} catch (Exception exception) {
throw new IllegalArgumentException(exception);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment