mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: 3dafa6a0 Updated Upstream (CraftBukkit) 77b05b9c Updated Upstream (Bukkit/CraftBukkit/Spigot)
69 lines
1.9 KiB
Diff
69 lines
1.9 KiB
Diff
From ba6cb31517bc0cdeb1fb90caf3eb3bbc8d58c617 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 | 19 +++++++++++++++++++
|
|
src/main/java/org/bukkit/Server.java | 15 +++++++++++++++
|
|
2 files changed, 34 insertions(+)
|
|
|
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
|
index 10d0537d0..d49cf61b4 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -1634,6 +1634,25 @@ public final class Bukkit {
|
|
public static boolean isLagging() {
|
|
return server.isLagging();
|
|
}
|
|
+
|
|
+ /**
|
|
+ * 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
|
|
|
|
@NotNull
|
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
|
index 97a981923..f98c6a046 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1428,5 +1428,20 @@ public interface Server extends PluginMessageRecipient {
|
|
* @return True if lagging
|
|
*/
|
|
boolean isLagging();
|
|
+
|
|
+ /**
|
|
+ * 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
|
|
|