diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-28 17:32:27 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-28 17:32:27 +0200 |
commit | ea0fa98cbd55f87c2f9ab5ab4032a9044feeb793 (patch) | |
tree | da267dd3c4f428241b6a1989cfae65aacbc7d21a /src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | |
parent | f20726ed77f21aead51ec3da2e90411c57aaf5f5 (diff) | |
download | skyhanni-ea0fa98cbd55f87c2f9ab5ab4032a9044feeb793.tar.gz skyhanni-ea0fa98cbd55f87c2f9ab5ab4032a9044feeb793.tar.bz2 skyhanni-ea0fa98cbd55f87c2f9ab5ab4032a9044feeb793.zip |
Fixed coins per copper display in SkyMall not showing when some items are not in the NEU Repo.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 568ccbb87..8633dcadd 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -55,21 +55,26 @@ object NEUItems { return result } - fun getItemStack(internalName: String): ItemStack { + fun getItemStackOrNull(internalName: String): ItemStack? { if (itemCache.contains(internalName)) { return itemCache[internalName]!!.copy() } val itemStack = ItemResolutionQuery(manager) .withKnownInternalName(internalName) - .resolveToItemStack() - if (itemStack == null) { + .resolveToItemStack() ?: return null + itemCache[internalName] = itemStack + return itemStack.copy() + } + + fun getItemStack(internalName: String): ItemStack { + val stack = getItemStackOrNull(internalName) + if (stack == null) { val error = "ItemResolutionQuery returns null for internalName $internalName" LorenzUtils.error(error) throw RuntimeException(error) } - itemCache[internalName] = itemStack - return itemStack.copy() + return stack } fun isVanillaItem(item: ItemStack) = manager.auctionManager.isVanillaItem(item.getInternalName()) |