From ec08babcd63289587a269dd45f5ba8488d2921e7 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 15 Apr 2023 19:14:58 +0200 Subject: code cleanup --- .../java/at/hannibal2/skyhanni/api/CollectionAPI.kt | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/api') diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt index 3c6caf271..ea4584119 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt @@ -30,27 +30,18 @@ class CollectionAPI { val profileData = event.profileData val jsonElement = profileData["collection"] ?: return val asJsonObject = jsonElement.asJsonObject ?: return - for ((rawName, rawCounter) in asJsonObject.entrySet()) { + for ((hypixelId, rawCounter) in asJsonObject.entrySet()) { val counter = rawCounter.asLong - var itemName = BazaarApi.getBazaarDataByInternalName(rawName)?.displayName - if (rawName == "MUSHROOM_COLLECTION") { - itemName = "Mushroom" - } - if (rawName == "MELON") { - itemName = "Melon" - } - if (rawName == "GEMSTONE_COLLECTION") { - itemName = "Gemstone" - } - + val neuItemId = NEUItems.transHypixelNameToInternalName(hypixelId) + val itemName = BazaarApi.getBazaarDataByInternalName(neuItemId)?.displayName // Hypixel moment - if (hypixelApiHasWrongItems.contains(rawName)) continue + if (hypixelApiHasWrongItems.contains(neuItemId)) continue if (itemName == null) { - LorenzUtils.debug("collection name is null for '$rawName'") + LorenzUtils.debug("collection name is null for '$neuItemId'") continue } - collectionValue[itemName] = counter + collectionValue[neuItemId] = counter } CollectionUpdateEvent().postAndCatch() -- cgit