Don't allow world unloading while ticking worlds (fixes #8080) (#8081)

This commit is contained in:
Noah van der Aa 2022-07-01 18:14:50 +02:00 committed by GitHub
parent a22eb678af
commit c029645443
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -35,7 +35,7 @@ index ed799a59411d637d0f50a62c73e2b23053fbcb0e..77cd45f616e2ff38ad6a648b8b865a99
this.profiler.popPush("connection"); this.profiler.popPush("connection");
MinecraftTimings.connectionTimer.startTiming(); // Spigot MinecraftTimings.connectionTimer.startTiming(); // Spigot
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java 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 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/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 { @@ -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"); Validate.notNull(creator, "Creator may not be null");
String name = creator.name(); 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;
}

View File

@ -20,10 +20,10 @@ index c0195f73cd2c8721e882c681eaead65471710081..861b348f73867af3199f1cc0dab1ddd4
Date date = new Date(); Date date = new Date();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java 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 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/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 // Paper end
Set<CommandSender> recipients = new HashSet<>(); Set<CommandSender> recipients = new HashSet<>();
for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) { for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) {