From 22538ddfb8c5094ff2b006250c095f9bd1eb05bb Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 6 Jan 2024 12:55:14 +0100 Subject: Auto fixing plots marked as pests when killing all pests without SkyHanni earlier. --- .../skyhanni/features/garden/pests/PestFinder.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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 -- cgit