diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index 7d2241b8..e35d4007 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -29,7 +29,7 @@ public enum ForgeManager implements Runnable { private static final BlockingQueue forge = new DelayQueue<>(); public static final AtomicInteger wordOrderCounter = new AtomicInteger(0); - public static final ConcurrentHashMap> vendorWorkOrderLookup = new ConcurrentHashMap<>(); + public static final ConcurrentHashMap> vendorWorkOrderLookup = new ConcurrentHashMap<>(); public static final ConcurrentHashMap itemWorkOrderLookup = new ConcurrentHashMap<>(); @Override diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java index 7e5acf18..59e348e0 100644 --- a/src/engine/gameManager/NPCManager.java +++ b/src/engine/gameManager/NPCManager.java @@ -27,7 +27,7 @@ import org.pmw.tinylog.Logger; import java.util.ArrayList; import java.util.HashMap; -import java.util.List; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ThreadLocalRandom; import static engine.math.FastMath.acos; @@ -523,7 +523,7 @@ public enum NPCManager { ArrayList itemList = new ArrayList<>(); - List vendorWorkOrders = ForgeManager.vendorWorkOrderLookup.get(npc); + ConcurrentHashMap.KeySetView vendorWorkOrders = ForgeManager.vendorWorkOrderLookup.get(npc); for (WorkOrder workOrder : vendorWorkOrders) itemList.addAll(workOrder.cooking); diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 1d463ae6..ddb12851 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -35,7 +35,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.locks.ReentrantReadWriteLock; import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup; @@ -873,7 +872,7 @@ public class NPC extends AbstractCharacter { // If NPC is a vendor then configure ForgeManager support if (this.contract.isTrainer() == false) - ForgeManager.vendorWorkOrderLookup.computeIfAbsent(this, k -> new CopyOnWriteArrayList<>()); + ForgeManager.vendorWorkOrderLookup.computeIfAbsent(this, k -> ConcurrentHashMap.newKeySet()); this.symbol = this.contract.getIconID(); this.modTypeTable = this.contract.getNPCModTypeTable();