diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-05-20 12:18:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-20 12:18:20 +0200 |
commit | fd42f05ce3b849ed579787607bf5f77080aebb7f (patch) | |
tree | 85d0cd2a3d91e4591b508ec41304f6f45f6a3159 /src/main/java/at | |
parent | 4eb39185cb08727050d9577fc5a6c91921b83eaf (diff) | |
download | skyhanni-fd42f05ce3b849ed579787607bf5f77080aebb7f.tar.gz skyhanni-fd42f05ce3b849ed579787607bf5f77080aebb7f.tar.bz2 skyhanni-fd42f05ce3b849ed579787607bf5f77080aebb7f.zip |
Fix: bazaar empty data (#1841)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt index 2cb70f857..cd9465264 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt @@ -62,6 +62,11 @@ object HypixelBazaarFetcher { val internalName = NEUItems.transHypixelNameToInternalName(key) val sellOfferPrice = product.buySummary.minOfOrNull { it.pricePerUnit } ?: 0.0 val insantBuyPrice = product.sellSummary.maxOfOrNull { it.pricePerUnit } ?: 0.0 + + if (product.quickStatus.isEmpty()) { + return@mapNotNull null + } + if (internalName.getItemStackOrNull() == null) { // Items that exist in Hypixel's Bazaar API, but not in NEU repo (not visible in in the ingame bazaar). // Should only include Enchants @@ -72,6 +77,17 @@ object HypixelBazaarFetcher { internalName to BazaarData(internalName.itemName, sellOfferPrice, insantBuyPrice, product) }.toMap() + private fun BazaarQuickStatus.isEmpty(): Boolean = with(this) { + sellPrice == 0.0 && + sellVolume == 0L && + sellMovingWeek == 0L && + sellOrders == 0L && + buyPrice == 0.0 && + buyVolume == 0L && + buyMovingWeek == 0L && + buyOrders == 0L + } + private fun onError(fetchType: String, e: Exception, rawResponse: String? = null) { val userMessage = "Failed fetching bazaar price data from hypixel" failedAttempts++ |