From c408c7d057b3162f05cdefe60973286f34c4b6b0 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 31 Dec 2020 16:26:37 -0800 Subject: [PATCH] avoid concurrent exceptions on TransientEntityTracker --- .../com/gmail/nossr50/util/TransientEntityTracker.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/util/TransientEntityTracker.java b/src/main/java/com/gmail/nossr50/util/TransientEntityTracker.java index 486842f7f..4b22abaea 100644 --- a/src/main/java/com/gmail/nossr50/util/TransientEntityTracker.java +++ b/src/main/java/com/gmail/nossr50/util/TransientEntityTracker.java @@ -6,6 +6,7 @@ import com.gmail.nossr50.skills.taming.TrackedTamingEntity; import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.gmail.nossr50.util.text.StringUtils; +import com.google.common.collect.ImmutableSet; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Location; @@ -215,13 +216,17 @@ public class TransientEntityTracker { for(CallOfTheWildType callOfTheWildType : CallOfTheWildType.values()) { HashSet trackedEntities = getTrackedEntities(playerUUID, callOfTheWildType); - if(trackedEntities == null) + if(trackedEntities == null) { continue; + } - for(TrackedTamingEntity trackedTamingEntity : trackedEntities) { + ImmutableSet immutableSet = ImmutableSet.copyOf(trackedEntities); + + for(TrackedTamingEntity trackedTamingEntity : immutableSet) { //Remove from existence removeSummon(trackedTamingEntity.getLivingEntity(), player, false); } + } } }