From 25f050f3872c7891b9f8483764340b41e9cb2d93 Mon Sep 17 00:00:00 2001 From: LoJoSho Date: Thu, 1 Aug 2024 18:27:38 -0500 Subject: [PATCH] Revert "feat: add user cosmetic item caching" This reverts commit 34b02574b2c4bffbf552bbab1c39131c34f44d3c. --- .../hibiscusmc/hmccosmetics/user/CosmeticUser.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java index 8b2a534b..c8f8a42f 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/CosmeticUser.java @@ -58,7 +58,6 @@ public class CosmeticUser { // Cosmetic Settings/Toggles private final ArrayList hiddenReason = new ArrayList<>(); - private final HashMap cachedCosmeticItems = new HashMap<>(); private final HashMap colors = new HashMap<>(); public CosmeticUser(UUID uuid) { @@ -157,7 +156,6 @@ public class CosmeticUser { if (slot == CosmeticSlot.EMOTE) { if (getUserEmoteManager().isPlayingEmote()) getUserEmoteManager().stopEmote(UserEmoteManager.StopEmoteReason.UNEQUIP); } - cachedCosmeticItems.remove(slot); colors.remove(slot); playerCosmetics.remove(slot); removeArmor(slot); @@ -229,10 +227,6 @@ public class CosmeticUser { if (cosmetic instanceof CosmeticBackpackType || cosmetic instanceof CosmeticBalloonType) return new ItemStack(Material.AIR); return getPlayer().getInventory().getItem(HMCCInventoryUtils.getEquipmentSlot(cosmetic.getSlot())); } - // Check if the item is cached. This helps with performance as we don't need to keep recreating the item - if (cachedCosmeticItems.containsKey(cosmetic.getSlot())) { - return cachedCosmeticItems.get(cosmetic.getSlot()); - } if (cosmetic instanceof CosmeticArmorType armorType) { item = armorType.getItem(this, cosmetic.getItem()); } @@ -255,10 +249,6 @@ public class CosmeticUser { //MessagesUtil.sendDebugMessages("GetUserCosemticUser Item is null"); return new ItemStack(Material.AIR); } - // Check if the item is cached. This helps with performance as we don't need to keep recreating the item - if (cachedCosmeticItems.containsKey(cosmetic.getSlot())) { - return cachedCosmeticItems.get(cosmetic.getSlot()); - } if (item.hasItemMeta()) { ItemMeta itemMeta = item.getItemMeta(); @@ -322,7 +312,6 @@ public class CosmeticUser { item.setItemMeta(itemMeta); } - cachedCosmeticItems.put(cosmetic.getSlot(), item); return item; }