aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt
index 741e52921..ebfa0ff8a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt
@@ -46,6 +46,7 @@ class EliteFarmingWeight {
lastLeaderboardUpdate = 0
nextPlayerWeight = 0.0
nextPlayerName = ""
+ hasPassedNext = false
}
var tick = 0
@@ -74,6 +75,7 @@ class EliteFarmingWeight {
private var nextPlayerName = ""
private var nextPlayerWeight = 0.0
+ private var hasPassedNext = false
private fun update() {
if (!GardenAPI.inGarden()) return
@@ -153,11 +155,18 @@ class EliteFarmingWeight {
if (weight < 0) return ""
val totalWeight = (localWeight + weight)
+ val weightUntilOvertake = nextPlayerWeight - totalWeight
+ if (weightUntilOvertake < 0) {
+ if (!hasPassedNext) {
+ leaderboardPosition--
+ nextPlayerWeight = 0.0
+ hasPassedNext = true
+ }
+ }
+
if (nextPlayerWeight == 0.0) {
return "§cRejoin the garden to show ETA!"
}
-
- val weightUntilOvertake = nextPlayerWeight - totalWeight
val timeTillOvertake = (weightUntilOvertake / weightPerSecond) * 1000
val timeFormat = TimeUtils.formatDuration(timeTillOvertake.toLong())