Add tick times API and /mspt command (#3102)
This commit is contained in:
parent
11de41c777
commit
588b62e47b
2 changed files with 237 additions and 0 deletions
65
Spigot-API-Patches/0193-Add-tick-times-API.patch
Normal file
65
Spigot-API-Patches/0193-Add-tick-times-API.patch
Normal file
|
@ -0,0 +1,65 @@
|
|||
From 1fe29f877ba04e8bed08b47c185ddb9244705507 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 b9973406..c3c2d9c6 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 80f9abdc..bfa83c9b 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
|
||||
--
|
||||
2.24.0
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue