SPIGOT-7999: ConcurrentModificationException in EntityLiving#hurtServer

This commit is contained in:
md_5 2025-03-09 16:41:21 +11:00
parent aa7768087a
commit e95450221f
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -516,7 +516,7 @@
if (!flag) { if (!flag) {
this.indicateDamage(d0, d1); this.indicateDamage(d0, d1);
} }
@@ -1282,7 +1526,7 @@ @@ -1282,12 +1526,12 @@
this.playHurtSound(damagesource); this.playHurtSound(damagesource);
} }
@ -525,6 +525,12 @@
if (flag2) { if (flag2) {
this.lastDamageSource = damagesource; this.lastDamageSource = damagesource;
this.lastDamageStamp = this.level().getGameTime();
- Iterator iterator = this.getActiveEffects().iterator();
+ Iterator iterator = new LinkedList<>(this.getActiveEffects()).iterator(); // CraftBukkit - SPIGOT-7999: copy to prevent CME in unrelated events
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
@@ -1363,7 +1607,7 @@ @@ -1363,7 +1607,7 @@
} }