mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-23 08:46:44 +01:00
SPIGOT-6362: ConcurrentModificationException: null --> Server Crash
By: md_5 <git@md-5.net>
This commit is contained in:
parent
373ed1ddd5
commit
64ef04d7e4
1 changed files with 30 additions and 10 deletions
|
@ -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 <T extends ParticleParam> 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 <T> String a(Collection<T> collection, Function<T, MinecraftKey> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<MinecraftKey> 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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue