Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
63 Zeilen
1.9 KiB
Diff
63 Zeilen
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 b997340686e86e05847bedcbf125e070c569b90a..c3c2d9c6b546459a614b5fdf5ec3debf4ebcabcf 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -1412,6 +1412,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 80f9abdca71bba79cbf09035cfd5534e41002a27..bfa83c9bb4d5f1ff4591e80fd38942d6c88cf960 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1188,6 +1188,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
|