aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorAlexia Luna <me@alexia.lol>2024-04-07 11:01:08 +0200
committerGitHub <noreply@github.com>2024-04-07 11:01:08 +0200
commit3cda068bcbb9b98a8e7704f5e14fffa535c079a1 (patch)
tree2795c89d862abe93e6b29b067fe7517c9c8ecf14 /src/main/java/at/hannibal2
parent0850dc6a0195d7e52cea13cc5838e75d216f81b7 (diff)
downloadskyhanni-3cda068bcbb9b98a8e7704f5e14fffa535c079a1.tar.gz
skyhanni-3cda068bcbb9b98a8e7704f5e14fffa535c079a1.tar.bz2
skyhanni-3cda068bcbb9b98a8e7704f5e14fffa535c079a1.zip
Feature: Clear plot sprays when Portable Washer is used (#1178)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotAPI.kt20
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