aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-06 12:55:14 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-06 12:55:14 +0100
commit22538ddfb8c5094ff2b006250c095f9bd1eb05bb (patch)
treeefd1c96905660c755c085c37b1135233c4e7eda8 /src/main/java/at/hannibal2
parentea1260bd9b54ae4f5f51a7e4058fa5a07e0f3240 (diff)
downloadskyhanni-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.kt18
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