mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-19 14:59:29 +00:00
87 lines
2.7 KiB
Diff
87 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Wed, 30 Nov 2022 12:57:37 +0100
|
|
Subject: [PATCH] Specific interval TPS API
|
|
|
|
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
Gale - https://galemc.org
|
|
|
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
|
index f380a518bc444bfdfbbedf38805c7684e53a5629..6309009fca193e8ceda4b3bf66ad4652e77dd015 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -2187,6 +2187,37 @@ public final class Bukkit {
|
|
return server.getTPS();
|
|
}
|
|
|
|
+ // Gale start - specific interval TPS API
|
|
+
|
|
+ /**
|
|
+ * Gets the average server TPS over the last 1 minute
|
|
+ *
|
|
+ * @return the average server TPS over the last 1 minute
|
|
+ */
|
|
+ public static double get1MinuteTPSAverage() {
|
|
+ return server.get1MinuteTPSAverage();
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the average server TPS over the last 5 minutes
|
|
+ *
|
|
+ * @return the average server TPS over the last 5 minutes
|
|
+ */
|
|
+ public static double get5MinuteTPSAverage() {
|
|
+ return server.get5MinuteTPSAverage();
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the average server TPS over the last 15 minutes
|
|
+ *
|
|
+ * @return the average server TPS over the last 15 minutes
|
|
+ */
|
|
+ public static double get15MinuteTPSAverage() {
|
|
+ return server.get15MinuteTPSAverage();
|
|
+ }
|
|
+
|
|
+ // Gale end - specific interval TPS API
|
|
+
|
|
/**
|
|
* Get a sample of the servers last tick times (in nanos)
|
|
*
|
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
|
index 2e93d4c072ed0b67743820801537e20d4c95afe7..a607520896041a48f2ffb75d4cb374d116fcf25c 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1861,6 +1861,31 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
|
@NotNull
|
|
public double[] getTPS();
|
|
|
|
+ // Gale start - specific interval TPS API
|
|
+
|
|
+ /**
|
|
+ * Gets the average server TPS over the last 1 minute
|
|
+ *
|
|
+ * @return the average server TPS over the last 1 minute
|
|
+ */
|
|
+ double get1MinuteTPSAverage();
|
|
+
|
|
+ /**
|
|
+ * Gets the average server TPS over the last 5 minutes
|
|
+ *
|
|
+ * @return the average server TPS over the last 5 minutes
|
|
+ */
|
|
+ double get5MinuteTPSAverage();
|
|
+
|
|
+ /**
|
|
+ * Gets the average server TPS over the last 15 minutes
|
|
+ *
|
|
+ * @return the average server TPS over the last 15 minutes
|
|
+ */
|
|
+ double get15MinuteTPSAverage();
|
|
+
|
|
+ // Gale end - specific interval TPS API
|
|
+
|
|
/**
|
|
* Get a sample of the servers last tick times (in nanos)
|
|
*
|