66 lines
1.8 KiB
Diff
66 lines
1.8 KiB
Diff
|
From 1fe29f877ba04e8bed08b47c185ddb9244705507 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 b9973406..c3c2d9c6 100644
|
||
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||
|
@@ -1412,6 +1412,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 80f9abdc..bfa83c9b 100644
|
||
|
--- a/src/main/java/org/bukkit/Server.java
|
||
|
+++ b/src/main/java/org/bukkit/Server.java
|
||
|
@@ -1188,6 +1188,21 @@ public interface Server extends PluginMessageRecipient {
|
||
|
*/
|
||
|
@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
|
||
|
--
|
||
|
2.24.0
|
||
|
|