From 8bb9051e59eb9a2cb40a39e6f0a6ef37fa522457 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 11 Jun 2020 11:47:46 +1200 Subject: [PATCH] Remove concurrenthashmap as its a relic of a failed async implemention and causes performance issues, fixes #478 --- .../disguise/utilities/DisguiseUtilities.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index 29c06a75..a44e698a 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -55,7 +55,6 @@ import java.io.*; import java.lang.reflect.*; import java.nio.charset.StandardCharsets; import java.util.*; -import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -113,7 +112,7 @@ public class DisguiseUtilities { * A hashmap of the uuid's of entitys, alive and dead. And their disguises in use */ @Getter - private static Map> disguises = new ConcurrentHashMap<>(); + private static Map> disguises = new HashMap<>(); /** * Disguises which are stored ready for a entity to be seen by a player Preferably, disguises in this should only * stay in for @@ -679,9 +678,11 @@ public class DisguiseUtilities { if (getDisguises().containsKey(entityId)) { for (TargetedDisguise disguise : getDisguises().get(entityId)) { - if (disguise.canSee(observer)) { - return disguise; + if (!disguise.canSee(observer)) { + continue; } + + return disguise; } }