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 5ce98e09e9bfcae45896401c69578aa879222893..dacb9342f21ba045b97f004c6c9970adbc2b9eb5 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -2429,6 +2429,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 a92bd4da6788f1331a4838ab5760baec2dc6e8ec..32ec411df95dbce73700ce47fb24737f1f508bb5 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -2076,6 +2076,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}