diff --git a/patches/api/0006-Add-TPS-From-Region.patch b/patches/api/0006-Add-TPS-From-Region.patch index bbe71ab..f537109 100644 --- a/patches/api/0006-Add-TPS-From-Region.patch +++ b/patches/api/0006-Add-TPS-From-Region.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add TPS From Region diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 67c021f6d5d2afed92c7ceb4f511e3a43bbe2417..1da5ee2835ee729b3dfbdc633669cdf304e2eba3 100644 +index 67c021f6d5d2afed92c7ceb4f511e3a43bbe2417..f85b6efd4d2982acfa173920c9fd601d1ff47cc2 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2397,6 +2397,30 @@ public final class Bukkit { +@@ -2397,6 +2397,28 @@ public final class Bukkit { } // Paper end @@ -17,10 +17,9 @@ index 67c021f6d5d2afed92c7ceb4f511e3a43bbe2417..1da5ee2835ee729b3dfbdc633669cdf3 + * 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) ++ * @return current location TPS (5s, 15s, 1m, 5m, 15m in Folia-Server), or null if the position is not loaded + */ -+ @NotNull -+ public double[] getTPS(Location location) { ++ public double @Nullable [] getTPS(Location location) { + return server.getTPS(location); + } + @@ -28,10 +27,9 @@ index 67c021f6d5d2afed92c7ceb4f511e3a43bbe2417..1da5ee2835ee729b3dfbdc633669cdf3 + * 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) ++ * @return current chunk TPS (5s, 15s, 1m, 5m, 15m in Folia-Server), or null if the chunk is not loaded + */ -+ @NotNull -+ public double[] getTPS(Chunk chunk){ ++ public double @Nullable [] getTPS(Chunk chunk){ + return server.getTPS(chunk); + } + // Folia end @@ -40,10 +38,10 @@ index 67c021f6d5d2afed92c7ceb4f511e3a43bbe2417..1da5ee2835ee729b3dfbdc633669cdf3 * 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 d4c5b06fe4be177442ef1abaf1b223c6c2845930..8fb11dea6dbba71970c48af8d308c9cae4426af8 100644 +index d4c5b06fe4be177442ef1abaf1b223c6c2845930..4d65b05931dff6420c4da45a3f8ab99f12a31980 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -2050,6 +2050,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2050,6 +2050,24 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi double getAverageTickTime(); // Paper end @@ -52,19 +50,17 @@ index d4c5b06fe4be177442ef1abaf1b223c6c2845930..8fb11dea6dbba71970c48af8d308c9ca + * 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) ++ * @return current location TPS (5s, 15s, 1m, 5m, 15m in Folia-Server), or null if the position is not loaded + */ -+ @NotNull -+ public double[] getTPS(Location location); ++ 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) ++ * @return current chunk TPS (5s, 15s, 1m, 5m, 15m in Folia-Server), or null if the chunk is not loaded + */ -+ @NotNull -+ public double[] getTPS(Chunk chunk); ++ public double @Nullable [] getTPS(Chunk chunk); + // Folia end + // Paper start diff --git a/patches/server/0019-Add-TPS-From-Region.patch b/patches/server/0019-Add-TPS-From-Region.patch index 157325b..698af48 100644 --- a/patches/server/0019-Add-TPS-From-Region.patch +++ b/patches/server/0019-Add-TPS-From-Region.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add TPS From Region diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 273c37b63df3f14488586f9217c7b19a8f3d8ad5..c383fa047c386952e7904b3d645b8f55498e4f25 100644 +index 273c37b63df3f14488586f9217c7b19a8f3d8ad5..e9156358bb42cb2e2e43029da1c2fa7e8e00f2f8 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -3114,6 +3114,41 @@ public final class CraftServer implements Server { +@@ -3114,6 +3114,42 @@ public final class CraftServer implements Server { }; } @@ -33,15 +33,16 @@ index 273c37b63df3f14488586f9217c7b19a8f3d8ad5..c383fa047c386952e7904b3d645b8f55 + io.papermc.paper.threadedregions.ThreadedRegionizer.ThreadedRegion + region = world.regioniser.getRegionAtSynchronised(x, z); + if (region == null) { -+ return new double[]{ 20.0, 20.0, 20.0, 20.0, 20.0 }; ++ return null; + } else { + io.papermc.paper.threadedregions.TickRegions.TickRegionData regionData = region.getData(); ++ final long currTime = System.nanoTime(); + return new double[] { -+ regionData.getRegionSchedulingHandle().getTickReport5s(System.nanoTime()).tpsData().segmentAll().average(), -+ regionData.getRegionSchedulingHandle().getTickReport15s(System.nanoTime()).tpsData().segmentAll().average(), -+ regionData.getRegionSchedulingHandle().getTickReport1m(System.nanoTime()).tpsData().segmentAll().average(), -+ regionData.getRegionSchedulingHandle().getTickReport5m(System.nanoTime()).tpsData().segmentAll().average(), -+ regionData.getRegionSchedulingHandle().getTickReport15m(System.nanoTime()).tpsData().segmentAll().average(), ++ regionData.getRegionSchedulingHandle().getTickReport5s(currTime).tpsData().segmentAll().average(), ++ regionData.getRegionSchedulingHandle().getTickReport15s(currTime).tpsData().segmentAll().average(), ++ regionData.getRegionSchedulingHandle().getTickReport1m(currTime).tpsData().segmentAll().average(), ++ regionData.getRegionSchedulingHandle().getTickReport5m(currTime).tpsData().segmentAll().average(), ++ regionData.getRegionSchedulingHandle().getTickReport15m(currTime).tpsData().segmentAll().average(), + }; + } + }