diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2023-09-10 11:11:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-10 11:11:14 +0200 |
commit | 823f74120b0d3f685a56a7b1f5c0d5b557b1aed5 (patch) | |
tree | f51ee43146e484739cd4eb7a74b3501109fc09a9 /src/main/java/at/hannibal2/skyhanni/features | |
parent | afc566a5f2400126c2a72642e303f8790979bebd (diff) | |
parent | e38cdf57f48cfbe4563a54505465918fa64a157a (diff) | |
download | skyhanni-823f74120b0d3f685a56a7b1f5c0d5b557b1aed5.tar.gz skyhanni-823f74120b0d3f685a56a7b1f5c0d5b557b1aed5.tar.bz2 skyhanni-823f74120b0d3f685a56a7b1f5c0d5b557b1aed5.zip |
Merge pull request #435 from ReyMaratov/contest_ff_fix
Fixed low bps causing impossible ff #435
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt index 7b0f01015..e885ad7a5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt @@ -23,6 +23,7 @@ class JacobContestTimeNeeded { private val config get() = SkyHanniMod.feature.garden private var display = emptyList<List<Any>>() private var currentBracket = ContestBracket.GOLD + private var lowBPSWarning = "" @SubscribeEvent(priority = EventPriority.LOW) fun onLateInventoryOpen(event: InventoryUpdatedEvent) { @@ -63,19 +64,35 @@ class JacobContestTimeNeeded { val timeInMinutes = amount.toDouble() / speed / 60 val formatDuration = TimeUtils.formatDuration((timeInMinutes * 60 * 1000).toLong()) val color = if (timeInMinutes < 20) "§b" else "§c" - val line: String + var line: String + var marking: String = "" var bracketText = "${bracket.displayName} $color$formatDuration" + var blocksPerSecond = crop.getLatestBlocksPerSecond() + if (blocksPerSecond == null) { + marking += "§0§l !" //hoping this never shows + blocksPerSecond = 19.9 + lowBPSWarning = "§cYour Blocks/second is too low, showing 19.9 Blocks/second instead!" + } else { + if (blocksPerSecond < 15.0) { + marking += "§4§l !" + blocksPerSecond = 19.9 + lowBPSWarning = "§cYour Blocks/second is too low, showing 19.9 Blocks/second instead!" + } else { + marking += " " + lowBPSWarning = "§aYour Blocks/second is good :)" + } + } if (timeInMinutes < 20) { - line = "§9${crop.cropName} §b$formatDuration" + line = "§9${crop.cropName} §b$formatDuration" + marking } else { line = - "§9${crop.cropName} §cNo ${currentBracket.displayName} §cMedal!" + "§9${crop.cropName} §cNo ${currentBracket.displayName} §cMedal!" + marking val cropFF = crop.getLatestTrueFarmingFortune() ?: 0.0 - val blocksPerSecond = crop.getLatestBlocksPerSecond() ?: 20.0 val cropsPerSecond = amount.toDouble() / blocksPerSecond / 60 val ffNeeded = cropsPerSecond * 100 / 20 / crop.baseDrops val missing = (ffNeeded - cropFF).toInt() bracketText += " §7(${missing.addSeparators()} more FF needed!)" + } brackets.add(bracketText) if (bracket == currentBracket) { @@ -83,6 +100,7 @@ class JacobContestTimeNeeded { showLine = line } } + map[crop] = Renderable.hoverTips(showLine, buildList { add("§7Time Needed for §9${crop.cropName} Medals§7:") addAll(brackets) @@ -91,7 +109,7 @@ class JacobContestTimeNeeded { add("§7Latest FF: §e${(latestFF).addSeparators()}") val bps = crop.getLatestBlocksPerSecond()?.round(1) ?: 0 add("§7Blocks/Second: §e${bps.addSeparators()}") - + add(lowBPSWarning) }) } |