mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
9c9583cd2b
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: 8f495b8d #564: Add method to get max world size CraftBukkit Changes: 768d7fc2d #773: Add method to get max world size Spigot Changes: 628435a8 #103: Add async catchers to Chunk#getEntities
63 lines
1.9 KiB
Diff
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 683c9dc0f183cdee8dd909835c0cb0fe9b033075..2d73a06dc6b6a5163696750cb563d52e327ab4d1 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -1464,6 +1464,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 af9f834f468cefbb72f798d63b9eb7b10811ed9f..a15e672be066cef7828a8e0c5b09209d8c268181 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1232,6 +1232,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
|