diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-23 11:39:56 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-23 11:39:56 +0100 |
commit | c6d70aa7b15c45f4be0c6d58bb1be516c3d054b1 (patch) | |
tree | 0d10081664a8e8f0b8c54ed16b50cd73367088f1 /src/main/java/at/hannibal2 | |
parent | 37328618bcd56ad892394dd1be11231f7848b19e (diff) | |
download | skyhanni-c6d70aa7b15c45f4be0c6d58bb1be516c3d054b1.tar.gz skyhanni-c6d70aa7b15c45f4be0c6d58bb1be516c3d054b1.tar.bz2 skyhanni-c6d70aa7b15c45f4be0c6d58bb1be516c3d054b1.zip |
Fixed edge case when passed the player in front of you
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt | 13 |
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()) |