Paper/patches/api/0192-Add-tick-times-API.patch
MiniDigger 79b873c901 Updated Upstream (Bukkit/CraftBukkit/Spigot)
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:
64c8bd39 #679: Add getHideOnlinePlayers
b991b6c7 #677: Add "Allow Server Listings" API
4e9f199a SPIGOT-6801: Wrong BlockData classes in Material enum for SOUL_FIRE and SOUL_TORCH

CraftBukkit Changes:
37e63e63 Fix loading / creating secondary worlds (nether/end)
4bf7f33c #956: Add getHideOnlinePlayers
d181e1ed Fix serializing unhandled NBT + add unit test with unhandled NBT
aebb79e3 #954: Add "Allow Server Listings" API
7c4707e4 #955: Add test for BlockData class of Material

Spigot Changes:
16c0cb41 Rebuild patches
2021-11-30 19:26:33 +01:00

63 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 caa3d77b5906a2227f6409a877bd0ba14d05caba..411d06b14a0892531ac578e51d0b166f670adbd6 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1720,6 +1720,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 bf1920857008c272d557f602544009986c3ed284..1cabf4de832b60abae8c25c0d80d409e8fa727cc 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1460,6 +1460,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