From c029645443cf7db35e8d2e2a0de05741993241c7 Mon Sep 17 00:00:00 2001 From: Noah van der Aa Date: Fri, 1 Jul 2022 18:14:50 +0200 Subject: [PATCH] Don't allow world unloading while ticking worlds (fixes #8080) (#8081) --- ...-exception-on-world-create-while-being-ticked.patch | 10 +++++++++- ...15-Don-t-broadcast-messages-to-command-blocks.patch | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/patches/server/0904-Throw-exception-on-world-create-while-being-ticked.patch b/patches/server/0904-Throw-exception-on-world-create-while-being-ticked.patch index af0ec19f81..7c74f41830 100644 --- a/patches/server/0904-Throw-exception-on-world-create-while-being-ticked.patch +++ b/patches/server/0904-Throw-exception-on-world-create-while-being-ticked.patch @@ -35,7 +35,7 @@ index ed799a59411d637d0f50a62c73e2b23053fbcb0e..77cd45f616e2ff38ad6a648b8b865a99 this.profiler.popPush("connection"); MinecraftTimings.connectionTimer.startTiming(); // Spigot diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 925c9359a3e33abfdc6463572b96191381cec480..6e4ccdcd1e9d3be217f26ad187300e15531fe811 100644 +index a8ed075021088d86753e0340ee23698191ee07e0..57da844bc8993d7eb8850df3696a8870600a8603 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1135,6 +1135,7 @@ public final class CraftServer implements Server { @@ -46,3 +46,11 @@ index 925c9359a3e33abfdc6463572b96191381cec480..6e4ccdcd1e9d3be217f26ad187300e15 Validate.notNull(creator, "Creator may not be null"); String name = creator.name(); +@@ -1259,6 +1260,7 @@ public final class CraftServer implements Server { + + @Override + public boolean unloadWorld(World world, boolean save) { ++ Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot unload a world while worlds are being ticked"); // Paper + if (world == null) { + return false; + } diff --git a/patches/server/0915-Don-t-broadcast-messages-to-command-blocks.patch b/patches/server/0915-Don-t-broadcast-messages-to-command-blocks.patch index f790f99c61..0f2b0360fa 100644 --- a/patches/server/0915-Don-t-broadcast-messages-to-command-blocks.patch +++ b/patches/server/0915-Don-t-broadcast-messages-to-command-blocks.patch @@ -20,10 +20,10 @@ index c0195f73cd2c8721e882c681eaead65471710081..861b348f73867af3199f1cc0dab1ddd4 Date date = new Date(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 6e4ccdcd1e9d3be217f26ad187300e15531fe811..61c2f864bb23e75f6c377f7ccbf2ec44a670348c 100644 +index 57da844bc8993d7eb8850df3696a8870600a8603..f6f4e7f393cdd03f0ec699ff461e1ac20ddef789 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1753,7 +1753,7 @@ public final class CraftServer implements Server { +@@ -1754,7 +1754,7 @@ public final class CraftServer implements Server { // Paper end Set recipients = new HashSet<>(); for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) {