PaperMC/patches/api/0193-Add-tick-times-API.patch
Shane Freeder 3aae7ef01a
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
214b9f14 SPIGOT-6605: Add method to access value of enforce-whitelist

CraftBukkit Changes:
b121d3b9 SPIGOT-6605: Add method to access value of enforce-whitelist
2021-06-29 01:31:35 +01:00

62 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 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 1954bf1be7b6c11edb918327a0632d5eda732ae7..d07c493a755b6d89fae6ed7b8d54cc46dc93ba1d 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1614,6 +1614,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 fd6c42f5ff067dba9c7547a0edff1d0d185f9ac5..c17f3267343fecb962914f653dd44c9173a58308 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1365,6 +1365,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@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