From c6f451bce10036ae5bb76390f5f7e544987f2123 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 9 Mar 2024 09:09:17 -0500 Subject: [PATCH] Remove from equip before changing slot. --- .../handlers/TransferItemFromEquipToInventoryHandler.java | 4 +++- src/engine/objects/CharacterItemManager.java | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/engine/net/client/handlers/TransferItemFromEquipToInventoryHandler.java b/src/engine/net/client/handlers/TransferItemFromEquipToInventoryHandler.java index 70f04fc6..3be438a1 100644 --- a/src/engine/net/client/handlers/TransferItemFromEquipToInventoryHandler.java +++ b/src/engine/net/client/handlers/TransferItemFromEquipToInventoryHandler.java @@ -58,8 +58,10 @@ public class TransferItemFromEquipToInventoryHandler extends AbstractClientMsgHa if (!item.validForEquip(origin, player, itemManager)) return true; - if (item.containerType == Enum.ItemContainerType.EQUIPPED) + if (item.containerType == Enum.ItemContainerType.EQUIPPED) { + itemManager.equipped.remove(item.equipSlot); itemManager.moveItemToInventory(item); + } int ItemType = item.getObjectType().ordinal(); int ItemID = item.getObjectUUID(); diff --git a/src/engine/objects/CharacterItemManager.java b/src/engine/objects/CharacterItemManager.java index db58211b..4fa6388d 100644 --- a/src/engine/objects/CharacterItemManager.java +++ b/src/engine/objects/CharacterItemManager.java @@ -46,7 +46,7 @@ public class CharacterItemManager { private final ConcurrentHashMap itemIDtoType = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); // Mapping of all items equipped in this Manager // Key = Item Slot - private final ConcurrentHashMap equipped = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); + public final ConcurrentHashMap equipped = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); private final HashSet inventory = new HashSet<>(); private final HashSet bank = new HashSet<>(); private final HashSet vault = new HashSet<>(); @@ -1691,8 +1691,6 @@ public class CharacterItemManager { } private synchronized void remItemFromLists(Item i) { - - this.equipped.remove(i.equipSlot); this.vault.remove(i); this.bank.remove(i); this.inventory.remove(i);