From eb4a6baf8e72bc2820f215a10afffacd7ff1001a Mon Sep 17 00:00:00 2001 From: themode Date: Thu, 25 Mar 2021 21:36:18 +0100 Subject: [PATCH] Use a thread safe Set for EntityCreature ai groups --- .../java/net/minestom/server/entity/EntityCreature.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minestom/server/entity/EntityCreature.java b/src/main/java/net/minestom/server/entity/EntityCreature.java index df8b3bb33..77de37bdf 100644 --- a/src/main/java/net/minestom/server/entity/EntityCreature.java +++ b/src/main/java/net/minestom/server/entity/EntityCreature.java @@ -14,15 +14,15 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collection; -import java.util.HashSet; import java.util.Set; import java.util.UUID; +import java.util.concurrent.CopyOnWriteArraySet; public class EntityCreature extends LivingEntity implements NavigableEntity, EntityAI { private int removalAnimationDelay = 1000; - private final Set aiGroups = new HashSet<>(); + private final Set aiGroups = new CopyOnWriteArraySet<>(); private final Navigator navigator = new Navigator(this); @@ -108,7 +108,7 @@ public class EntityCreature extends LivingEntity implements NavigableEntity, Ent @Override public Collection getAIGroups() { - return this.aiGroups; + return aiGroups; } /**