From c243e0fdce709c61caf04356c94bc04fac37a0d6 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 24 Mar 2023 23:54:35 +0100 Subject: Hide elite farming leaderboard eta time when not farming --- .../skyhanni/features/garden/EliteFarmingWeight.kt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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 b62bffb25..612bebfbc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt @@ -160,7 +160,9 @@ class EliteFarmingWeight { val weightUntilOvertake = nextPlayerWeight - totalWeight if (weightUntilOvertake < 0) { if (!hasPassedNext) { - LorenzUtils.chat("§e[SkyHanni] You passed §b$nextName §ein the Farming Weight Leaderboard!") + if (weightPerSecond != -1.0) { + LorenzUtils.chat("§e[SkyHanni] You passed §b$nextName §ein the Farming Weight Leaderboard!") + } if (leaderboardPosition == -1) { leaderboardPosition = 1000 } else { @@ -174,13 +176,14 @@ class EliteFarmingWeight { if (nextPlayerWeight == 0.0) { return "§cRejoin the garden to show ETA!" } - val timeTillOvertake = (weightUntilOvertake / weightPerSecond) * 1000 - val timeFormat = TimeUtils.formatDuration(timeTillOvertake.toLong()) - - val format = LorenzUtils.formatDouble(weightUntilOvertake, 2) - - // TODO Maybe add next player name? - return "§e$format §7(§b$timeFormat§7) §7behind §b$nextName" + val timeFormat = if (weightPerSecond != -1.0) { + val timeTillOvertake = (weightUntilOvertake / weightPerSecond) * 1000 + val format = TimeUtils.formatDuration(timeTillOvertake.toLong()) + " §7(§b$format§7)" + } else "" + + val weightFormat = LorenzUtils.formatDouble(weightUntilOvertake, 2) + return "§e$weightFormat$timeFormat §7behind §b$nextName" } private fun isEnabled() = GardenAPI.inGarden() && config.eliteFarmingWeightDisplay -- cgit