aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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