Paper/Spigot-API-Patches/0192-Add-tick-times-API.patch
Aikar 2712c68885
[Auto] Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears 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:
f1e73b03 #525: Add contributors plugin.yml field.
ef0999fe #529: Added getRecipe() method to retrieve a Recipe by it's NamespacedKey

CraftBukkit Changes:
8b831a965 #714: Added getRecipe() method to retrieve a Recipe by it's NamespacedKey
2020-07-22 04:26:59 -04: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 018a8c871f3afdd8b6e1b156b2113f62e330e3d3..1b9f18b3a48e5f31b1cecbf7ab40c86fef4f44bd 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1455,6 +1455,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 93337d6eaf27999043ae09e7240689e7c4e78ace..a07c848039e8a36e07d5362bda499f113bb61f1e 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1225,6 +1225,21 @@ public interface Server extends PluginMessageRecipient {
*/
@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