2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-04-11 07:52:17 +02:00
|
|
|
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
|
2020-12-13 01:42:05 +01:00
|
|
|
index 683c9dc0f183cdee8dd909835c0cb0fe9b033075..2d73a06dc6b6a5163696750cb563d52e327ab4d1 100644
|
2020-04-11 07:52:17 +02:00
|
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
2020-12-13 01:42:05 +01:00
|
|
|
@@ -1464,6 +1464,25 @@ public final class Bukkit {
|
2020-04-11 07:52:17 +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
|
2020-12-13 01:42:05 +01:00
|
|
|
index af9f834f468cefbb72f798d63b9eb7b10811ed9f..a15e672be066cef7828a8e0c5b09209d8c268181 100644
|
2020-04-11 07:52:17 +02:00
|
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
2020-12-13 01:42:05 +01:00
|
|
|
@@ -1232,6 +1232,21 @@ public interface Server extends PluginMessageRecipient {
|
2020-04-11 07:52:17 +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
|