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
|
2021-06-14 03:06:38 +02:00
|
|
|
index 02f91b446697b1c637fda3b65b48ec8cf38de66d..1eeb1257888ef2e2d92598e2b1a80286a087dfa5 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
|
|
|
|
@@ -1590,6 +1590,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
|
2021-06-14 03:06:38 +02:00
|
|
|
index b038a82ffc298abb5129b6ec20538df5d0b6f595..3c9890ce33231070836ee471206b20cec74e00b4 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
|
|
|
|
@@ -1345,6 +1345,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
|
|
|
*/
|
|
|
|
@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
|