diff --git a/paper-server/nms-patches/WorldServer.patch b/paper-server/nms-patches/WorldServer.patch index 33f4a40308..b1baf9aec2 100644 --- a/paper-server/nms-patches/WorldServer.patch +++ b/paper-server/nms-patches/WorldServer.patch @@ -504,7 +504,27 @@ if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j)); } -@@ -995,10 +1185,20 @@ +@@ -973,7 +1163,18 @@ + Iterator iterator = this.navigators.iterator(); + + while (iterator.hasNext()) { +- NavigationAbstract navigationabstract = (NavigationAbstract) iterator.next(); ++ // CraftBukkit start - fix SPIGOT-6362 ++ NavigationAbstract navigationabstract; ++ try { ++ navigationabstract = (NavigationAbstract) iterator.next(); ++ } catch (java.util.ConcurrentModificationException ex) { ++ // This can happen because the pathfinder update below may trigger a chunk load, which in turn may cause more navigators to register ++ // In this case we just run the update again across all the iterators as the chunk will then be loaded ++ // As this is a relative edge case it is much faster than copying navigators (on either read or write) ++ notify(blockposition, iblockdata, iblockdata1, i); ++ return; ++ } ++ // CraftBukkit end + + if (!navigationabstract.i()) { + navigationabstract.b(blockposition); +@@ -995,10 +1196,20 @@ @Override public Explosion createExplosion(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) { @@ -525,7 +545,7 @@ if (explosion_effect == Explosion.Effect.NONE) { explosion.clearBlocks(); } -@@ -1063,13 +1263,20 @@ +@@ -1063,13 +1274,20 @@ } public int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) { @@ -548,7 +568,7 @@ ++j; } } -@@ -1111,7 +1318,7 @@ +@@ -1111,7 +1329,7 @@ @Nullable public BlockPosition a(StructureGenerator structuregenerator, BlockPosition blockposition, int i, boolean flag) { @@ -557,7 +577,7 @@ } @Nullable -@@ -1149,7 +1356,13 @@ +@@ -1149,7 +1367,13 @@ @Override public WorldMap a(String s) { return (WorldMap) this.getMinecraftServer().E().getWorldPersistentData().b(() -> { @@ -572,7 +592,7 @@ }, s); } -@@ -1460,6 +1673,11 @@ +@@ -1460,6 +1684,11 @@ @Override public void update(BlockPosition blockposition, Block block) { if (!this.isDebugWorld()) { @@ -584,7 +604,7 @@ this.applyPhysics(blockposition, block); } -@@ -1474,12 +1692,12 @@ +@@ -1474,12 +1703,12 @@ } public boolean isFlatWorld() { @@ -599,7 +619,7 @@ } @Nullable -@@ -1499,9 +1717,9 @@ +@@ -1499,9 +1728,9 @@ @VisibleForTesting public String F() { @@ -611,7 +631,7 @@ return IRegistry.BLOCK_ENTITY_TYPE.getKey(tileentity.getTileType()); }), this.getBlockTickList().a(), this.getFluidTickList().a(), this.P()); } -@@ -1509,7 +1727,7 @@ +@@ -1509,7 +1738,7 @@ private static String a(Collection collection, Function function) { try { Object2IntOpenHashMap object2intopenhashmap = new Object2IntOpenHashMap(); @@ -620,7 +640,7 @@ while (iterator.hasNext()) { T t0 = iterator.next(); -@@ -1518,7 +1736,8 @@ +@@ -1518,7 +1747,8 @@ object2intopenhashmap.addTo(minecraftkey, 1); } @@ -630,7 +650,7 @@ return it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey() + ":" + it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue(); }).collect(Collectors.joining(",")); } catch (Exception exception) { -@@ -1527,16 +1746,32 @@ +@@ -1527,16 +1757,32 @@ } public static void a(WorldServer worldserver) {