Skip to content

Instantly share code, notes, and snippets.

@vemacs
Last active April 9, 2016 21:42
Embed
What would you like to do?
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