diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt index 351613d90..ee856135f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt @@ -66,6 +66,10 @@ object GardenPlotAPI { "spray.target", "§a§lSPRAYONATOR! §r§7You sprayed §r§aPlot §r§7- §r§b(?<plot>.*) §r§7with §r§a(?<spray>.*)§r§7!" ) + private val portableWasherPattern by patternGroup.pattern( + "spray.cleared.portablewasher", + "§9§lSPLASH! §r§6Your §r§bGarden §r§6was cleared of all active §r§aSprayonator §r§6effects!" + ) var plots = listOf<Plot>() @@ -174,6 +178,14 @@ object GardenPlotAPI { } } + private fun Plot.removeSpray() { + getData()?.apply { + sprayType = null + sprayExpiryTime = SimpleTimeMark.now() + sprayHasNotified = true + } + } + fun Plot.isBarn() = id == 0 fun Plot.isPlayerInside() = box.isPlayerInside() @@ -237,6 +249,14 @@ object GardenPlotAPI { val plot = getPlotByID(plotId) plot?.locked = false } + + portableWasherPattern.matchMatcher(event.message) { + for (plot in plots) { + if (plot.currentSpray != null) { + plot.removeSpray() + } + } + } } @SubscribeEvent |