From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MrHua269 Date: Tue, 30 Jul 2024 17:58:25 +0800 Subject: [PATCH] FoliaPR Add TPS From Region diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java index 886920b33b37bdefc301f898ad0003e40eff6443..122433e2f0d3c8dfedb30814c8b24e75d4fe879f 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -2394,6 +2394,28 @@ public final class Bukkit { } // Paper end + // Folia start + /** + * Gets the current location TPS. + * + * @param location the location for which to get the TPS + * @return current location TPS (5s, 15s, 1m, 5m, 15m in Folia-Server), or null if the region doesn't exist + */ + public double @Nullable [] getTPS(Location location) { + return server.getTPS(location); + } + + /** + * Gets the current chunk TPS. + * + * @param chunk the chunk for which to get the TPS + * @return current chunk TPS (5s, 15s, 1m, 5m, 15m in Folia-Server), or null if the region doesn't exist + */ + public double @Nullable [] getTPS(Chunk chunk){ + return server.getTPS(chunk); + } + // Folia end + /** * Get the advancement specified by this key. * diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java index d6f72cb1e2380bd1a18d695c7d26ae3834f6eb52..280ce7ca1bfdd4b7924a48675192e24489b82b9e 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -2047,6 +2047,24 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi double getAverageTickTime(); // Paper end + // Folia start + /** + * Gets the current location TPS. + * + * @param location the location for which to get the TPS + * @return current location TPS (5s, 15s, 1m, 5m, 15m in Folia-Server), or null if the region doesn't exist + */ + public double @Nullable [] getTPS(Location location); + + /** + * Gets the current chunk TPS. + * + * @param chunk the chunk for which to get the TPS + * @return current chunk TPS (5s, 15s, 1m, 5m, 15m in Folia-Server), or null if the region doesn't exist + */ + public double @Nullable [] getTPS(Chunk chunk); + // Folia end + // Paper start /** * Gets the active {@link org.bukkit.command.CommandMap}