From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers 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 b243db56756c67cd2c41d7768898d01539f9260a..a177509cff1f66bc7f48488b9440e573a443c3b5 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -2135,6 +2135,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 f0bd65cb60510a8b3014d902602c306657c75bfd..d9bf9c7ad36f7b8d99342e43e7af81075c039431 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1810,6 +1810,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) *