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

Paper Changes:
ad708dd3 Add option to allow iron golems to spawn in air (Closes #1965, Closes #1851)
b16fd5c3 Updated Upstream (Bukkit/CraftBukkit/Spigot)
2020-03-10 19:30:18 -05:00

70 lines
2.0 KiB
Diff

From 56c9dfec5e48c93e44bf73e8d841c851202320c2 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 3a60094a..6935cf27 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1664,4 +1664,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 0f7e84fb..df1765b5 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1470,4 +1470,21 @@ public interface Server extends PluginMessageRecipient {
*/
int getCurrentTick();
// 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