diff --git a/patches/api/0005-Add-API-for-checking-ownership-of-region-by-position.patch b/patches/api/0005-Add-API-for-checking-ownership-of-region-by-position.patch index 0ad8457..ad9c3ac 100644 --- a/patches/api/0005-Add-API-for-checking-ownership-of-region-by-position.patch +++ b/patches/api/0005-Add-API-for-checking-ownership-of-region-by-position.patch @@ -11,10 +11,10 @@ the schedulers depending on the result of the ownership check. diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 7986b9fcaf256e9042f6d9ddc38e8bd76645cbb7..a1295698beee025120beb3d151e77646bb44723b 100644 +index 7986b9fcaf256e9042f6d9ddc38e8bd76645cbb7..3c940426f1ea03bb1279b4f397549642e98dd72d 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2496,6 +2496,100 @@ public final class Bukkit { +@@ -2496,6 +2496,107 @@ public final class Bukkit { public static @NotNull io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler getGlobalRegionScheduler() { return server.getGlobalRegionScheduler(); } @@ -111,15 +111,22 @@ index 7986b9fcaf256e9042f6d9ddc38e8bd76645cbb7..a1295698beee025120beb3d151e77646 + */ + public static boolean isOwnedByCurrentRegion(@NotNull Entity entity) { + return server.isOwnedByCurrentRegion(entity); ++ } ++ ++ /** ++ * Returns whether the current thread is ticking the global region. ++ */ ++ public static boolean isGlobalTickThread() { ++ return server.isGlobalTickThread(); + } // Folia end - region threading API @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 5caa00a413450dee18739f6430ffaf5095ea3036..b04742bafbb4045d5842ac96761a941cfd3fc758 100644 +index 5caa00a413450dee18739f6430ffaf5095ea3036..c230a10aff36f6b484d7e3963cbf8073f8676fb1 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -2170,5 +2170,85 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2170,5 +2170,90 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi * @return the global region scheduler */ public @NotNull io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler getGlobalRegionScheduler(); @@ -203,5 +210,10 @@ index 5caa00a413450dee18739f6430ffaf5095ea3036..b04742bafbb4045d5842ac96761a941c + * @param entity Specified entity. + */ + public boolean isOwnedByCurrentRegion(@NotNull Entity entity); ++ ++ /** ++ * Returns whether the current thread is ticking the global region. ++ */ ++ public boolean isGlobalTickThread(); // Folia end - region threading API } diff --git a/patches/server/0004-Threaded-Regions.patch b/patches/server/0004-Threaded-Regions.patch index 1ac5448..de191af 100644 --- a/patches/server/0004-Threaded-Regions.patch +++ b/patches/server/0004-Threaded-Regions.patch @@ -23078,10 +23078,10 @@ index 1d7c663fa0e550bd0cfb9a4b83ccd7e2968666f0..f3df9c9b6cff85565514f990597f3fe5 LevelChunkTicks levelChunkTicks = this.allContainers.get(l); if (levelChunkTicks == null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index e0b6c737f9de2b6e692d6813d8dea4c35f038573..851937baff90177e648d970cf1c462b897aaf9f5 100644 +index e0b6c737f9de2b6e692d6813d8dea4c35f038573..27445d7bcfaaa34a60e65e8d339f15367d7b3b6e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -303,6 +303,76 @@ public final class CraftServer implements Server { +@@ -303,6 +303,82 @@ public final class CraftServer implements Server { CraftItemFactory.instance(); } @@ -23153,12 +23153,18 @@ index e0b6c737f9de2b6e692d6813d8dea4c35f038573..851937baff90177e648d970cf1c462b8 + public final boolean isOwnedByCurrentRegion(Entity entity) { + return io.papermc.paper.util.TickThread.isTickThreadFor(((org.bukkit.craftbukkit.entity.CraftEntity)entity).getHandle()); + } ++ ++ @Override ++ public boolean isGlobalTickThread() { ++ return io.papermc.paper.threadedregions.RegionizedServer.isGlobalTickThread(); ++ } ++ + // Folia end - region threading API + public CraftServer(DedicatedServer console, PlayerList playerList) { this.console = console; this.playerList = (DedicatedPlayerList) playerList; -@@ -856,6 +926,9 @@ public final class CraftServer implements Server { +@@ -856,6 +932,9 @@ public final class CraftServer implements Server { // NOTE: Should only be called from DedicatedServer.ah() public boolean dispatchServerCommand(CommandSender sender, ConsoleInput serverCommand) { @@ -23168,7 +23174,7 @@ index e0b6c737f9de2b6e692d6813d8dea4c35f038573..851937baff90177e648d970cf1c462b8 if (sender instanceof Conversable) { Conversable conversable = (Conversable) sender; -@@ -875,12 +948,44 @@ public final class CraftServer implements Server { +@@ -875,12 +954,44 @@ public final class CraftServer implements Server { } } @@ -23213,7 +23219,7 @@ index e0b6c737f9de2b6e692d6813d8dea4c35f038573..851937baff90177e648d970cf1c462b8 // Paper Start if (!org.spigotmc.AsyncCatcher.shuttingDown && !Bukkit.isPrimaryThread()) { final CommandSender fSender = sender; -@@ -2894,7 +2999,7 @@ public final class CraftServer implements Server { +@@ -2894,7 +3005,7 @@ public final class CraftServer implements Server { @Override public int getCurrentTick() { diff --git a/patches/server/0009-Make-CraftEntity-getHandle-and-overrides-perform-thr.patch b/patches/server/0009-Make-CraftEntity-getHandle-and-overrides-perform-thr.patch index 8d5c9d3..ec0ab62 100644 --- a/patches/server/0009-Make-CraftEntity-getHandle-and-overrides-perform-thr.patch +++ b/patches/server/0009-Make-CraftEntity-getHandle-and-overrides-perform-thr.patch @@ -87,7 +87,7 @@ index f038f6d4e9fc4b76d5774fc637171191405ee7bb..55a03a3b22c37338d32aeb0878169c44 if (this.passengers.size() == 1 && this.passengers.get(0) == entity) { this.passengers = ImmutableList.of(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 851937baff90177e648d970cf1c462b897aaf9f5..8fbe4e8a43940163efaa74da99eb077ae0a426f9 100644 +index 27445d7bcfaaa34a60e65e8d339f15367d7b3b6e..788ac73125620ceaaec390a6498451b65d16d325 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -369,7 +369,7 @@ public final class CraftServer implements Server { @@ -97,8 +97,8 @@ index 851937baff90177e648d970cf1c462b897aaf9f5..8fbe4e8a43940163efaa74da99eb077a - return io.papermc.paper.util.TickThread.isTickThreadFor(((org.bukkit.craftbukkit.entity.CraftEntity)entity).getHandle()); + return io.papermc.paper.util.TickThread.isTickThreadFor(((org.bukkit.craftbukkit.entity.CraftEntity)entity).getHandleRaw()); // Folia - add thread checks to getHandle } - // Folia end - region threading API + @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java index 1c8d63e462f3ed3d5286659ae0d1ec04d8b55177..116341b777f898a8080cc348499159c0f01b7329 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java diff --git a/patches/server/0011-Throw-UnsupportedOperationException-for-broken-APIs.patch b/patches/server/0011-Throw-UnsupportedOperationException-for-broken-APIs.patch index 0f12957..3f4955a 100644 --- a/patches/server/0011-Throw-UnsupportedOperationException-for-broken-APIs.patch +++ b/patches/server/0011-Throw-UnsupportedOperationException-for-broken-APIs.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Throw UnsupportedOperationException() for broken APIs diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 8fbe4e8a43940163efaa74da99eb077ae0a426f9..29602f9c2f1e04677a462079c094e9b51cec43af 100644 +index 788ac73125620ceaaec390a6498451b65d16d325..32c9b38036052649b7b5fb25d7c4a49fdd1ca972 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1239,6 +1239,7 @@ public final class CraftServer implements Server { +@@ -1245,6 +1245,7 @@ public final class CraftServer implements Server { @Override public World createWorld(WorldCreator creator) { @@ -16,7 +16,7 @@ index 8fbe4e8a43940163efaa74da99eb077ae0a426f9..29602f9c2f1e04677a462079c094e9b5 Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP"); //Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot create a world while worlds are being ticked"); // Paper - Cat - Temp disable. We'll see how this goes. Validate.notNull(creator, "Creator may not be null"); -@@ -1379,6 +1380,7 @@ public final class CraftServer implements Server { +@@ -1385,6 +1386,7 @@ public final class CraftServer implements Server { @Override public boolean unloadWorld(World world, boolean save) {