diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt index 4a12ac29d..02172ac8e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt @@ -340,12 +340,6 @@ class GardenCropMilestoneDisplay { val missing = need - have - val blocksPerSecond = averageBlocksPerSecond * (currentCrop?.multiplier ?: 1) - - val missingTimeSeconds = missing / blocksPerSecond - val millis = missingTimeSeconds * 1000 - val duration = TimeUtils.formatDuration(millis.toLong()) - lineMap[0] = Collections.singletonList("§6Mooshroom Cow Perk") val list = mutableListOf<Any>() @@ -354,7 +348,16 @@ class GardenCropMilestoneDisplay { lineMap[1] = list lineMap[2] = Collections.singletonList("§e$haveFormat§8/§e$needFormat") - lineMap[3] = Collections.singletonList("§7In §b$duration") + + + if (averageBlocksPerSecond != 0.0) { + val blocksPerSecond = averageBlocksPerSecond * (currentCrop?.multiplier ?: 1) + + val missingTimeSeconds = missing / blocksPerSecond + val millis = missingTimeSeconds * 1000 + val duration = TimeUtils.formatDuration(millis.toLong()) + lineMap[3] = Collections.singletonList("§7In §b$duration") + } val percentageFormat = LorenzUtils.formatPercentage(have.toDouble() / need.toDouble()) lineMap[4] = Collections.singletonList("§7Percentage: §e$percentageFormat") |