summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/bazaar
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-13 20:25:33 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-13 20:25:33 +0100
commita35b093c39c9dce7697d1daacecab199a44c9f40 (patch)
tree4c8a5b86e0ab38b898c28c49ba6509294070f006 /src/main/java/at/hannibal2/skyhanni/features/bazaar
parent5a75b69da9f8b1cfa7705c6d6b9850d72b5a0ab6 (diff)
downloadskyhanni-a35b093c39c9dce7697d1daacecab199a44c9f40.tar.gz
skyhanni-a35b093c39c9dce7697d1daacecab199a44c9f40.tar.bz2
skyhanni-a35b093c39c9dce7697d1daacecab199a44c9f40.zip
Show the time it takes to kill the Slayer boss.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/bazaar')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarUpdateTimer.kt11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarUpdateTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarUpdateTimer.kt
index 0a99f942a..a60af8ec8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarUpdateTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarUpdateTimer.kt
@@ -5,10 +5,11 @@ import at.hannibal2.skyhanni.events.BazaarUpdateEvent
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
+import at.hannibal2.skyhanni.utils.TimeUnit
+import at.hannibal2.skyhanni.utils.TimeUtils
import net.minecraftforge.client.event.GuiScreenEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.text.DecimalFormat
class BazaarUpdateTimer {
private var lastBazaarUpdateTime = 0L
@@ -24,13 +25,11 @@ class BazaarUpdateTimer {
if (!isEnabled()) return
if (!BazaarApi.isBazaarInventory(InventoryUtils.openInventoryName())) return
- val duration = System.currentTimeMillis() - lastBazaarUpdateTime
- val durationSeconds = duration.toDouble() / 1000
- val nextUpdateIn = 10 - durationSeconds
- val format = if (nextUpdateIn < 0) {
+ val duration = 10_000 - (System.currentTimeMillis() - lastBazaarUpdateTime)
+ val format = if (duration < 0) {
"Updating"
} else {
- DecimalFormat("0.0").format(nextUpdateIn)
+ TimeUtils.formatDuration(duration, TimeUnit.SECOND, showMilliSeconds = true)
}
val list = mutableListOf<String>()