From 3cda068bcbb9b98a8e7704f5e14fffa535c079a1 Mon Sep 17 00:00:00 2001 From: Alexia Luna Date: Sun, 7 Apr 2024 11:01:08 +0200 Subject: Feature: Clear plot sprays when Portable Washer is used (#1178) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/features/garden/GardenPlotAPI.kt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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(?.*) §r§7with §r§a(?.*)§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() @@ -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 -- cgit