9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-22 16:29:26 +00:00
Files
Gale/patches/api/0009-Specific-interval-TPS-API.patch
Dreeam 38ba9230bc Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@8fd3a67 [ci skip] Clean up book limits patch (#11297)
PaperMC/Paper@dae906b Add getWorld method that uses adventure Key (#11199)
PaperMC/Paper@ba1b016 Allow server administrators to disable book size checks (#10457)
PaperMC/Paper@a8cb8e6 [ci skip] Fix JavaDocs for HeightMap#MOTION_BLOCKING_NO_LEAVES (#11291)
PaperMC/Paper@e4b38b4 Fixup config parsing
PaperMC/Paper@3271119 Fix SculkBloomEvent firing for block entity loading (#11306)
2024-08-20 10:57:00 -04:00

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 419c056faf0d49d9b0435feb01252e87e227b9a9..1288934d6f2ee77dc20b6c284b6cd65382df3cfb 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2385,6 +2385,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 39bf006b2fc62f74ce893f86dcc5a8e80fb4967a..dd6b76aa7c741e9b6967dba293d65ba06db0f22b 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2042,6 +2042,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)
*