Skip to content

Instantly share code, notes, and snippets.

@rz7d
Created September 15, 2016 09:08
Show Gist options
  • Save rz7d/6be7b3016fc1be67479f5c9034909617 to your computer and use it in GitHub Desktop.
Save rz7d/6be7b3016fc1be67479f5c9034909617 to your computer and use it in GitHub Desktop.
private int getPing(Player player) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException {
Method method = player.getClass().getDeclaredMethod("getHandle");
method.setAccessible(true);
Object handle = method.invoke(player);
return ((Integer) handle.getClass().getField("ping").get(handle)).intValue();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment