diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-01-06 12:55:14 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-01-06 12:55:14 +0100 |
commit | 22538ddfb8c5094ff2b006250c095f9bd1eb05bb (patch) | |
tree | efd1c96905660c755c085c37b1135233c4e7eda8 /src/main/java/at/hannibal2 | |
parent | ea1260bd9b54ae4f5f51a7e4058fa5a07e0f3240 (diff) | |
download | skyhanni-22538ddfb8c5094ff2b006250c095f9bd1eb05bb.tar.gz skyhanni-22538ddfb8c5094ff2b006250c095f9bd1eb05bb.tar.bz2 skyhanni-22538ddfb8c5094ff2b006250c095f9bd1eb05bb.zip |
Auto fixing plots marked as pests when killing all pests without SkyHanni earlier.
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt index 47ddfd5c2..ad4f97626 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestFinder.kt @@ -141,6 +141,8 @@ class PestFinder { } } + resetAllPests(newPests) + if (newPests == PestAPI.scoreboardPests) return removePests(PestAPI.scoreboardPests - newPests) @@ -148,6 +150,22 @@ class PestFinder { update() } + // Auto fixing plots marked as pests when killing all pests without SkyHanni earlier. + private fun resetAllPests(newPests: Int) { + if (newPests != 0) return + + var fixed = false + for (plot in GardenPlotAPI.plots) { + if (plot.pests > 0) { + fixed = true + plot.pests = 0 + } + } + if (fixed) { + LorenzUtils.debug("Auto fixed all plots with pests.") + } + } + private fun removePests(removedPests: Int) { if (!isEnabled()) return if (removedPests < 1) return |