Files
Purpur/patches/api/0009-Add-tick-times-API.patch
William Blake Galbreath 193c511fce Updated Upstream (Paper)
Upstream has released updates that appears to apply and compile correctly

Paper Changes:
a4f066cc Fix method profiler inbalance introduced in a2a9ffe (#3132)
c65dcad3 Don't delay chunk unloads during entity ticking
bc17ce69 Delay unsafe actions until after entity ticking is done - Fixes #3114
5553e6b3 Disable Sync Events firing Async errors during shutdown
e12c51d9 Use better variable for isStopping() API
586ee2bb Remove patch for MC-111480, fixed in 1.14
09a94215 Remove streams from Mob AI System
bb5c294e Fix Disabling Asynchronous Chunks
089d8356 Implement Chunk Priority / Urgency System for World Gen
fce69af7 Use dedicated thread for main thread blocking chunk loads
588b62e4 Add tick times API and /mspt command (#3102)
11de41c7 Add API MinecraftServer#isStopping (#3129)
942ff3c2 My patches are under MIT (#3130)
2020-04-12 03:45:54 -05:00

70 lines
2.0 KiB
Diff

From 190a3d3ef1cd3a3444da5965a8230f44883ebcd3 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 30 Jan 2020 00:41:08 -0600
Subject: [PATCH] Add tick times API
---
src/main/java/org/bukkit/Bukkit.java | 21 +++++++++++++++++++++
src/main/java/org/bukkit/Server.java | 17 +++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 9cac2d299..14e85ac6c 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1692,4 +1692,25 @@ public final class Bukkit {
public static Server.Spigot spigot() {
return server.spigot();
}
+
+ // Purpur start
+ /**
+ * 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();
+ }
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 8f16fb0cb..90b439071 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1487,4 +1487,21 @@ public interface Server extends PluginMessageRecipient {
*/
boolean isStopping();
// Paper end
+
+ // Purpur start
+ /**
+ * 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();
+ // Purpur end
}
--
2.24.0