From 3468dcc7df5d93157dd16d0a9b6d6ddbd736a5a0 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 17 Nov 2023 11:30:27 +0100 Subject: removed gray guess format, added support for breaking blocks time change. --- .../features/garden/visitor/GardenVisitorTimer.kt | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt index 7e26e900b..9f7fbe367 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt @@ -136,14 +136,20 @@ class GardenVisitorTimer { } } val sinceLastTimerUpdate = lastTimerUpdate.passedSince() - 100.milliseconds - val showGrayGuess = visitorsAmount < 5 && sinceLastTimerUpdate in 500.milliseconds..60.seconds + val guessTime = visitorsAmount < 5 && sinceLastTimerUpdate in 500.milliseconds..60.seconds + if (guessTime) { + millis -= sinceLastTimerUpdate + } val diff = lastMillis - millis - if (diff == 0.seconds && visitorsAmount == lastVisitors && !showGrayGuess) return + if (diff == 0.seconds && visitorsAmount == lastVisitors) return lastMillis = millis lastVisitors = visitorsAmount - val formatColor = if (queueFull) "6" else "e" + val formatColor = when { + queueFull -> "6" + else -> "e" + } val extraSpeed = if (diff in 2.seconds..10.seconds) { val factor = diff.inWholeSeconds.toDouble() @@ -154,12 +160,7 @@ class GardenVisitorTimer { SoundUtils.playBeepSound() } - val formatDuration = if (showGrayGuess) { - val oneMinute = 60.seconds - val min = TimeUtils.formatDuration(millis - oneMinute, maxUnits = 1) - val sec = (oneMinute - sinceLastTimerUpdate).format(maxUnits = 1) - "$min §7$sec" - } else TimeUtils.formatDuration(millis) + val formatDuration = TimeUtils.formatDuration(millis) val next = if (queueFull && (!isSixthVisitorEnabled() || millis.isNegative())) "§cQueue Full!" else { "Next in §$formatColor$formatDuration$extraSpeed" } @@ -188,6 +189,7 @@ class GardenVisitorTimer { fun onBlockBreak(event: CropClickEvent) { if (!isEnabled()) return sixthVisitorArrivalTime -= 100.milliseconds + lastTimerUpdate -= 100.milliseconds } private fun updateSixthVisitorArrivalTime() { -- cgit