From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sun, 5 Apr 2020 22:22:58 -0500
Subject: [PATCH] Add tick times API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index af91f6cf87ad0f01370db31720fe318d84786ebd..a6808ead643db1833e1bb2a5f758f1e1d73059c1 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1897,6 +1897,25 @@ public final class Bukkit {
public static double[] getTPS() {
return server.getTPS();
}
+
+ /**
+ * Get a sample of the servers last tick times (in nanos)
+ *
+ * @return A sample of the servers last tick times (in nanos)
+ */
+ @NotNull
+ public static long[] getTickTimes() {
+ return server.getTickTimes();
+ }
+ * Get the average tick time (in millis)
+ * @return Average tick time (in millis)
+ public static double getAverageTickTime() {
+ return server == null ? 0D : server.getAverageTickTime();
// Paper end
/**
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index dc119a58c02a6b4177d560b70f026db6d9e08c55..02139695e15ec52b09ccbdf6105fa2bc786cf9be 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1616,6 +1616,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull
public double[] getTPS();
+ long[] getTickTimes();
+ double getAverageTickTime();
// Paper start