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

Paper Changes:
df0d7b0d Update upstream CB
6ea3c2cf [CI-SKIP] Rebuild patches
d7bed4cb Heavily optimise random block ticking (#2914)
b66d9ff8 Update upstream CB
ba71c5d6 Stop stripping private use block Unicode from signs
28d9dcfc Entity Jump API (#1587)
9976a768 Fix PlayerNaturallySpawnCreaturesEvent boolean inversion
054e20da Clean up imports on ThrownEggHatchEvent
a8984ccb Add ThrownEggHatchEvent (#1982)
9f24d495 Allow nerfed blazes, endermen to take water damage (#2847)
2020-02-12 21:21:34 -06:00

69 lines
1.9 KiB
Diff

From cf027551379cf75f6751acda9b3e8d1dc5b75dc1 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 | 20 ++++++++++++++++++++
src/main/java/org/bukkit/Server.java | 17 +++++++++++++++++
2 files changed, 37 insertions(+)
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 50415189..36e48723 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1620,4 +1620,24 @@ public final class Bukkit {
public static Server.Spigot spigot() {
return server.spigot();
}
+
+ // Purpur start
+ /**
+ * Get the last 100 tick times (in nanos)
+ * @return Last 100 tick times (in nanos)
+ */
+ @NotNull
+ public static long[] getTickTimes() {
+ return server.getTickTimes();
+ }
+
+ /**
+ * Get the average tick time (in millis) of the last 100 ticks
+ *
+ * @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 248c32b0..c28cc59c 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1413,4 +1413,21 @@ public interface Server extends PluginMessageRecipient {
*/
int getCurrentTick();
// Paper end
+
+ // Purpur start
+ /**
+ * Get the last 100 tick times (in nanos)
+ *
+ * @return Last 100 tick times (in nanos)
+ */
+ @NotNull
+ long[] getTickTimes();
+
+ /**
+ * Get the average tick time (in millis) of the last 100 ticks
+ *
+ * @return Average tick time (in millis)
+ */
+ double getAverageTickTime();
+ // Purpur end
}
--
2.24.0