2021-06-11 14:02:28 +02:00
|
|
|
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
|
2022-06-07 19:03:07 +02:00
|
|
|
index f6a862fcf269865eacc67088833bfdd09b661654..3fb45f03f3901de5592e2bb6ba8f75b5fd474509 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
2022-05-06 14:21:58 +02:00
|
|
|
@@ -1898,6 +1898,25 @@ public final class Bukkit {
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
2022-05-20 18:57:07 +02:00
|
|
|
index ad1d73940908f4f20a4944e81b186739fded20ab..6fe653a2a0fd4f07d39ed584bc11688d4926d54e 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
2022-05-20 18:57:07 +02:00
|
|
|
@@ -1614,6 +1614,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
2021-06-11 14:02:28 +02:00
|
|
|
*/
|
|
|
|
@NotNull
|
|
|
|
public double[] getTPS();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Get a sample of the servers last tick times (in nanos)
|
|
|
|
+ *
|
|
|
|
+ * @return A sample of the servers last tick times (in nanos)
|
|
|
|
+ */
|
|
|
|
+ @NotNull
|
|
|
|
+ long[] getTickTimes();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Get the average tick time (in millis)
|
|
|
|
+ *
|
|
|
|
+ * @return Average tick time (in millis)
|
|
|
|
+ */
|
|
|
|
+ double getAverageTickTime();
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
// Paper start
|