diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-23 17:16:20 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-23 17:16:20 +0200 |
commit | 4e5d32ba8d743bbd5e7a1f854bd97874d681b2a4 (patch) | |
tree | e53d6600efa304fbe0d9fb9fb5cc2b450f07f8e9 | |
parent | d16891c6c1e46ca8356deb5685f1551e32ecee45 (diff) | |
download | skyhanni-4e5d32ba8d743bbd5e7a1f854bd97874d681b2a4.tar.gz skyhanni-4e5d32ba8d743bbd5e7a1f854bd97874d681b2a4.tar.bz2 skyhanni-4e5d32ba8d743bbd5e7a1f854bd97874d681b2a4.zip |
Hide chat messages from the visitors in garden. (Except Beth and Spaceman)
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | FEATURES.md | 1 | ||||
-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 | 25 |
4 files changed, 33 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 01dc0c675..64a94ea62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,7 @@ + Added **Composter Overlay** - Show the cheapest items for organic matter and fuel, show profit per compost/hour/day and time per compost + Added **Composter Upgrades Overlay** - Show an overview of all composter stats, including time till organic matter and fuel is empty when fully filled and show a preview how these stats change when hovering over an upgrade + Hide crop money display, crop milestone display and garden visitor list while inside anita show, SkyMart or the composter inventory ++ Hide chat messages from the visitors in garden. (Except Beth and Spaceman) ### Features from other Mods > *The following features are only there because I want them when testing SkyHanni features without other mods present.* diff --git a/FEATURES.md b/FEATURES.md index 30392f0f8..69a91fc3f 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -216,6 +216,7 @@ + **Composter Overlay** - Show the cheapest items for organic matter and fuel, show profit per compost/hour/day and time per compost + **Composter Upgrades Overlay** - Show an overview of all composter stats, including time till organic matter and fuel is empty when fully filled and show a preview how these stats change when hovering over an upgrade + Hide crop money display, crop milestone display and garden visitor list while inside anita show, SkyMart or the composter inventory ++ Hide chat messages from the visitors in garden. (Except Beth and Spaceman) ## Commands + **/wiki <search term>** - using hypixel-skyblock.fandom.com instead of Hypixel wiki. 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 b6bb30838..7547d3e1b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java @@ -167,6 +167,12 @@ public class Garden { public boolean visitorHypixelArrivedMessage = true; @Expose + @ConfigOption(name = "Hide Chat", desc = "Hide chat messages from the visitors in garden. (Except Beth and Spaceman)") + @ConfigEditorBoolean + @ConfigAccordionId(id = 1) + public boolean visitorHideChat = 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 3f27138b8..1bababdb1 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 @@ -43,6 +43,7 @@ class GardenVisitorFeatures { private val newVisitorArrivedMessage = ".* §r§ehas arrived on your §r§bGarden§r§e!".toPattern() private val copperPattern = " §8\\+§c(.*) Copper".toPattern() private val gardenExperiencePattern = " §8\\+§2(.*) §7Garden Experience".toPattern() + private val visitorChatMessagePattern = "§e\\[NPC] (§.)?(?<name>.*)§f: §r§f.*".toPattern() private val config get() = SkyHanniMod.feature.garden private val logger = LorenzLogger("garden/visitors") @@ -462,6 +463,30 @@ class GardenVisitorFeatures { event.blockedReason = "new_visitor_arrived" } } + + if (GardenAPI.inGarden()) { + if (config.visitorHideChat) { + if (hideVisitorMessage(event.message)) { + event.blockedReason = "garden_visitor_message" + } + } + } + } + + private fun hideVisitorMessage(message: String): Boolean { + val matcher = visitorChatMessagePattern.matcher(message) + if (!matcher.matches()) return false + + val name = matcher.group("name") + if (name == "Spaceman") return false + if (name == "Beth") return false + + if (visitors.keys.any { it.removeColor() == name }) { + println("blocked msg from '$name'") + return true + } + + return false } private fun update() { |