From c3caf0b538747d46d02f38a2d2182c821ef1b0f0 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 11 May 2023 12:43:44 +0200 Subject: Added support for lower case names and common typos in /shtrackcollection --- .../at/hannibal2/skyhanni/api/CollectionAPI.kt | 25 +++++----------------- 1 file changed, 5 insertions(+), 20 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 08010207a..80ff8659f 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt @@ -17,17 +17,6 @@ class CollectionAPI { private val counterPattern = "(?:.*) §e(?.*)§6\\/(?:.*)".toPattern() private val singleCounterPattern = "§7Total Collected: §e(?.*)".toPattern() -// private val hypixelApiHasWrongItems = listOf( -// "WOOL", -// "CORRUPTED_FRAGMENT", -// "EGG", -// "POISONOUS_POTATO", -// "REDSTONE_BLOCK", -// "MUSHROOM_COLLECTION", -// "RAW_SOULFLOW", -// "GEMSTONE_COLLECTION", -// ) - @SubscribeEvent fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) { val profileData = event.profileData @@ -36,14 +25,10 @@ class CollectionAPI { for ((hypixelId, rawCounter) in asJsonObject.entrySet()) { val counter = rawCounter.asLong val neuItemId = NEUItems.transHypixelNameToInternalName(hypixelId) - val itemName = BazaarApi.getBazaarDataByInternalName(neuItemId)?.displayName - // Hypixel moment -// if (hypixelApiHasWrongItems.contains(neuItemId)) continue - if (itemName == null) { -// LorenzUtils.debug("collection name is null for '$neuItemId'") - continue - } + // MUSHROOM_COLLECTION, GEMSTONE_COLLECTION + BazaarApi.getBazaarDataByInternalName(neuItemId)?.displayName ?: continue + collectionValue[neuItemId] = counter } @@ -101,10 +86,10 @@ class CollectionAPI { fun isCollectionTier0(lore: List) = lore.map { collectionTier0Pattern.matcher(it) }.any { it.matches() } - fun getCollectionCounter(searchName: String): Pair? { + fun getCollectionCounter(searchName: String): Long? { for ((collectionName, counter) in collectionValue) { if (collectionName.equals(searchName, true)) { - return Pair(collectionName, counter) + return counter } } return null -- cgit