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
|
2023-07-04 10:22:56 +02:00
|
|
|
index 93c83d1513745ada3c1ea9b5cc88905f1957d3c4..d715a069a8cfc8704471f254f421bb7baeb498f4 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
|
2023-07-04 10:22:56 +02:00
|
|
|
@@ -2035,6 +2035,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
|
2023-07-04 10:22:56 +02:00
|
|
|
index 3b3cd9994b84770dc9b3c7a0531461bdc3d4b16a..e00d4860ba9ac19014995e85fccea659793f67e7 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
|
2023-07-04 10:22:56 +02:00
|
|
|
@@ -1718,6 +1718,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
|