diff options
author | Walker Selby <git@walkerselby.com> | 2023-09-29 11:30:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-29 20:30:27 +0200 |
commit | 343d5d9cea12beaf7a8dfabda2f61ad940be592a (patch) | |
tree | ceb0a82790eaa1a1babfe4a2e05220378037a748 /src/main/java/at/hannibal2/skyhanni/features/minion | |
parent | b364b6da62668ea44dfc23180fe70c13ec707804 (diff) | |
download | skyhanni-343d5d9cea12beaf7a8dfabda2f61ad940be592a.tar.gz skyhanni-343d5d9cea12beaf7a8dfabda2f61ad940be592a.tar.bz2 skyhanni-343d5d9cea12beaf7a8dfabda2f61ad940be592a.zip |
Random Code Cleanup (#516)
Sonar Lint for the win #516
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/minion')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index 852c17bae..2f4c3a59b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -177,10 +177,8 @@ class MinionFeatures { if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return if (coinsPerDay != "") return - if (Minecraft.getMinecraft().currentScreen is GuiChest) { - if (config.hopperProfitDisplay) { - coinsPerDay = if (minionInventoryOpen) updateCoinsPerDay() else "" - } + if (Minecraft.getMinecraft().currentScreen is GuiChest && config.hopperProfitDisplay) { + coinsPerDay = if (minionInventoryOpen) updateCoinsPerDay() else "" } } @@ -232,24 +230,19 @@ class MinionFeatures { if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return val message = event.message - if (message.matchRegex("§aYou received §r§6(.*) coins§r§a!")) { - if (System.currentTimeMillis() - lastInventoryClosed < 2_000) { + if (message.matchRegex("§aYou received §r§6(.*) coins§r§a!") && System.currentTimeMillis() - lastInventoryClosed < 2_000) { minions?.get(lastMinion)?.let { - it.lastClicked = System.currentTimeMillis() - } + it.lastClicked = System.currentTimeMillis() } } - if (message.startsWith("§aYou picked up a minion!")) { - if (lastMinion != null) { - minions = minions?.editCopy { remove(lastMinion) } - lastClickedEntity = null - lastMinion = null - lastMinionOpened = 0L - } + if (message.startsWith("§aYou picked up a minion!") && lastMinion != null) { + minions = minions?.editCopy { remove(lastMinion) } + lastClickedEntity = null + lastMinion = null + lastMinionOpened = 0L } - if (message.startsWith("§bYou placed a minion!")) { - if (newMinion != null) { + if (message.startsWith("§bYou placed a minion!") && newMinion != null) { minions = minions?.editCopy { this[newMinion!!] = Storage.ProfileSpecific.MinionConfig().apply { displayName = newMinionName @@ -258,7 +251,6 @@ class MinionFeatures { } newMinion = null newMinionName = null - } } minionUpgradePattern.matchMatcher(message) { @@ -293,13 +285,11 @@ class MinionFeatures { event.drawString(location.add(0.0, 0.65, 0.0), name, true) } - if (config.emptiedTimeDisplay) { - if (lastEmptied != 0L) { - val duration = System.currentTimeMillis() - lastEmptied - val format = TimeUtils.formatDuration(duration, longName = true) + " ago" - val text = "§eHopper Emptied: $format" - event.drawString(location.add(0.0, 1.15, 0.0), text, true) - } + if (config.emptiedTimeDisplay && lastEmptied != 0L) { + val duration = System.currentTimeMillis() - lastEmptied + val format = TimeUtils.formatDuration(duration, longName = true) + " ago" + val text = "§eHopper Emptied: $format" + event.drawString(location.add(0.0, 1.15, 0.0), text, true) } } } |