Skip to content

Instantly share code, notes, and snippets.

@vemacs
Last active August 28, 2016 23:34
Show Gist options
  • Save vemacs/6a345b2f9822b79a9a7f to your computer and use it in GitHub Desktop.
Save vemacs/6a345b2f9822b79a9a7f to your computer and use it in GitHub Desktop.
private static Object minecraftServer;
private static Field recentTps;
public static double[] getRecentTps() {
try {
if (minecraftServer == null) {
Server server = Bukkit.getServer();
Field consoleField = server.getClass().getDeclaredField("console");
consoleField.setAccessible(true);
minecraftServer = consoleField.get(server);
}
if (recentTps == null) {
recentTps = minecraftServer.getClass().getSuperclass().getDeclaredField("recentTps");
recentTps.setAccessible(true);
}
return (double[]) recentTps.get(minecraftServer);
} catch (IllegalAccessException | NoSuchFieldException ignored) {
}
return new double[] {20, 20, 20};
}
@Janmm14
Copy link

Janmm14 commented Dec 5, 2015

What information does that array include exactly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment