aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt
index 642298ba5..7318f1aa5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt
@@ -13,9 +13,7 @@ internal class BazaarDataGrabber(private var bazaarMap: MutableMap<String, Bazaa
companion object {
private val itemNames = mutableMapOf<String, String>()
- private var lastData = ""
var lastTime = 0L
- var blockNoChange = false
var currentlyUpdating = false
}
@@ -60,27 +58,16 @@ internal class BazaarDataGrabber(private var bazaarMap: MutableMap<String, Bazaa
}
private fun checkIfUpdateNeeded() {
- if (lastData != "") {
- if (System.currentTimeMillis() - lastTime > 9_000) {
- blockNoChange = true
- } else {
- if (blockNoChange) {
- return
- }
- }
+ if (System.currentTimeMillis() > lastTime + 10_000) {
+ currentlyUpdating = true
+ lastTime = System.currentTimeMillis()
+ updateBazaarData()
+ currentlyUpdating = false
}
-
- currentlyUpdating = true
- updateBazaarData()
- currentlyUpdating = false
}
private fun updateBazaarData() {
val bazaarData = APIUtil.getJSONResponse("https://api.hypixel.net/skyblock/bazaar")
- if (bazaarData.toString() != lastData) {
- lastData = bazaarData.toString()
- lastTime = System.currentTimeMillis()
- }
val products = bazaarData["products"].asJsonObject