mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-13 19:28:03 +01:00
Make a copy for worldloadevent to avoid como's - fixes #1453
If you try to load a world inresponse to another world loading, a concurrent modification exception will throw. This avoids that by making a defensive copy of the list for the server init stage. you might want to do this if you want to guarantee your world loads immediately after the vanilla worlds before another plugin has a chance to load worlds during POST_WORLD plugin stage.
This commit is contained in:
parent
3dfc0ef816
commit
94dc83b4cf
1 changed files with 10 additions and 1 deletions
|
@ -217,7 +217,7 @@ index 0000000000..af9e4455c6
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index fb62320310..2912e9ec68 100644
|
||||
index fb62320310..98d182fdb8 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
|
@ -229,4 +229,13 @@ index fb62320310..2912e9ec68 100644
|
|||
private PlayerList s;
|
||||
private boolean isRunning = true;
|
||||
private boolean isRestarting = false; // Paper - flag to signify we're attempting to restart
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
||||
}
|
||||
}
|
||||
|
||||
- for (WorldServer world : this.getWorlds()) {
|
||||
+ for (WorldServer world : com.google.common.collect.Lists.newArrayList(this.getWorlds())) { // Paper - avoid como if 1 world triggers another world
|
||||
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(world.getWorld()));
|
||||
}
|
||||
// CraftBukkit end
|
||||
--
|
Loading…
Add table
Reference in a new issue