mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-04 18:01:17 +01:00
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 663d8e27ba6625a20201a9abc66371dc71eeee42..86a9db588b1009d10e66f8e6a5aca7929148d227 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -1702,6 +1702,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 339bcb8d47c3d9856cf5fbc87ba3a104f414c462..c51860ac56d60c08ba9a06dd70c6860dccd4c490 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1446,6 +1446,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
|