From e04efa84f7d42ddcbe11eb65f25adc0e524a3aaa Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 9 Aug 2023 13:23:26 +0200 Subject: Using NEUInternalName in CollectionAPI --- src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt | 12 +++--------- 1 file changed, 3 insertions(+), 9 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 8fd1b4cb5..c5f6c6e0a 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt @@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.events.CollectionUpdateEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_new import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -91,19 +90,14 @@ class CollectionAPI { fun isCollectionTier0(lore: List) = lore.map { collectionTier0Pattern.matcher(it) }.any { it.matches() } - fun getCollectionCounter(itemName: String) = getCollectionCounter(NEUItems.getInternalName_new(itemName)) - fun getCollectionCounter(internalName: NEUInternalName) = collectionValue[internalName] // TODO add support for replenish (higher collection than actual items in inv) - fun addFromInventory(internalNameRaw: String, amount: Int) { - val stack = NEUItems.getItemStackOrNull(internalNameRaw) - if (stack == null) { - LorenzUtils.debug("CollectionAPI.addFromInventory: internalName is null for '$internalNameRaw'") + fun addFromInventory(internalName: NEUInternalName, amount: Int) { + if (internalName.getItemStackOrNull() == null) { + LorenzUtils.debug("CollectionAPI.addFromInventory: item is null for '$internalName'") return } - val internalName = stack.getInternalName_new() - collectionValue.addOrPut(internalName, amount.toLong()) } } -- cgit