2021-06-11 14:02:28 +02:00
|
|
|
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
|
2024-04-06 23:20:29 +02:00
|
|
|
index 999f72af999a95642b5865144d1da9bd9f86aaee..10aea8b80b49a6c47b04de4d3f33eb786f08651b 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
2024-04-06 23:20:29 +02:00
|
|
|
@@ -2147,6 +2147,25 @@ public final class Bukkit {
|
2021-06-11 14:02:28 +02:00
|
|
|
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
|
2024-04-06 23:20:29 +02:00
|
|
|
index 8445a62af2ca5dd47b4905d75b31d9d6ea0623ea..4b3fadfc90299cc717d85cb9856662e2b3230872 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
2024-04-06 23:20:29 +02:00
|
|
|
@@ -1817,6 +1817,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
2021-06-11 14:02:28 +02:00
|
|
|
*/
|
|
|
|
@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
|