diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-15 20:49:59 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-15 20:49:59 +0200 |
commit | 07e037fc8247db31df2e73c2ac2b9f957ed5a6bb (patch) | |
tree | f69791fa380ee2ab72d14de444a85c7d5ffb4842 /src/main/java | |
parent | f0029421b834ba4724abdcf95af20ff6919ea560 (diff) | |
download | skyhanni-07e037fc8247db31df2e73c2ac2b9f957ed5a6bb.tar.gz skyhanni-07e037fc8247db31df2e73c2ac2b9f957ed5a6bb.tar.bz2 skyhanni-07e037fc8247db31df2e73c2ac2b9f957ed5a6bb.zip |
Option to hide the chat message from hypixel that a new visitor has arrived at your garden (default enabled)
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/Garden.java | 6 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt | 22 |
2 files changed, 12 insertions, 16 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java index 40f55bd83..0341b341a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java @@ -147,6 +147,12 @@ public class Garden { public boolean visitorColoredName = true; @Expose + @ConfigOption(name = "Hypixel Message", desc = "Hide the chat message from hypixel that a new visitor has arrived at your garden") + @ConfigEditorBoolean + @ConfigAccordionId(id = 1) + public boolean visitorHypixelArrivedMessage = true; + + @Expose @ConfigOption(name = "Numbers", desc = "") @ConfigEditorAccordion(id = 5) public boolean numbers = false; diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 3a92b0f23..72c8a753b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -36,9 +36,9 @@ class GardenVisitorFeatures { private var display = listOf<List<Any>>() private var lastClickedNpc = 0 private var tick = 0 + private val newVisitorArrivedMessage = Pattern.compile(".* §r§ehas arrived on your §r§bGarden§r§e!") private val copperPattern = Pattern.compile(" §8\\+§c(.*) Copper") private val gardenExperiencePattern = Pattern.compile(" §8\\+§2(.*) §7Garden Experience") - private val offerAcceptedPattern = Pattern.compile("§6§lOFFER ACCEPTED §r§8with §r(.*) §r.*") private val config get() = SkyHanniMod.feature.garden companion object { @@ -187,7 +187,6 @@ class GardenVisitorFeatures { @SubscribeEvent fun onOwnInventoryItemUpdate(event: OwnInventorItemUpdateEvent) { if (GardenAPI.onBarnPlot) { - println("OwnInventorItemUpdateEvent") update() } } @@ -401,18 +400,11 @@ class GardenVisitorFeatures { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { -// val matcher = offerAcceptedPattern.matcher(event.message) -// if (!matcher.matches()) return -// -// val visitorName = matcher.group(1) -// for (visitor in visitors) { -// if (visitor.key == visitorName) { -// oldStatus(visitor.value) -// visitor.value.status = VisitorStatus.ACCEPTED -// statusChange(visitor.value) -// update() -// } -// } + if (config.visitorHypixelArrivedMessage) { + if (newVisitorArrivedMessage.matcher(event.message).matches()) { + event.blockedReason = "new_visitor_arrived" + } + } } private fun update() { @@ -421,7 +413,6 @@ class GardenVisitorFeatures { } private fun checkVisitorsReady() { -// println("checkVisitorsReady") for ((visitorName, visitor) in visitors) { val entity = visitor.getEntity() if (entity == null) { @@ -485,7 +476,6 @@ class GardenVisitorFeatures { } if (visitorName in listOf("Jacob", "Anita")) { - // Only detect jacob/anita npc if the "wrong" npc got found as well if (foundVisitorNameTags.size != 2) return null |