diff options
author | martimavocado <39881008+martimavocado@users.noreply.github.com> | 2024-03-02 22:47:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-02 23:47:42 +0100 |
commit | 0d1867cfb62a8f13345518d4b26de9bf0fecd1a4 (patch) | |
tree | 1fb6f7ab6de096bd19158ab14ecdef90b3668f2e /src/main/java/at/hannibal2 | |
parent | 4abbee0b73db299d1ae31336ab9b7d6d15903016 (diff) | |
download | skyhanni-0d1867cfb62a8f13345518d4b26de9bf0fecd1a4.tar.gz skyhanni-0d1867cfb62a8f13345518d4b26de9bf0fecd1a4.tar.bz2 skyhanni-0d1867cfb62a8f13345518d4b26de9bf0fecd1a4.zip |
Feature: Add more messages to chat hider (#1030)
Diffstat (limited to 'src/main/java/at/hannibal2')
3 files changed, 35 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java index e46d8052a..16ffec127 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/chat/ChatConfig.java @@ -124,4 +124,16 @@ public class ChatConfig { @ConfigEditorBoolean @FeatureToggle public boolean skyBlockXPInChat = true; + + @Expose + @ConfigOption(name = "Jacob's Event", desc = "Hide Anita Accessories' fortune bonus messages outside the Garden.") + @ConfigEditorBoolean + @FeatureToggle + public boolean hideJacob = true; + + @Expose + @ConfigOption(name = "Sky Mall", desc = "Hides the Sky Mall message outside Mining Islands.") + @ConfigEditorBoolean + @FeatureToggle + public boolean hideSkyMall = true; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt index e7e843e3f..12fbf7d76 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -3,14 +3,18 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpaceAndResets +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern class ChatFilter { + private val generalConfig get() = SkyHanniMod.feature.chat private val config get() = SkyHanniMod.feature.chat.filterType /// <editor-fold desc="Regex Patterns & Messages"> @@ -244,6 +248,7 @@ class ChatFilter { private val annoyingSpamPatterns = listOf( "§7Your Implosion hit (.*) for §r§c(.*) §r§7damage.".toPattern(), "§7Your Molten Wave hit (.*) for §r§c(.*) §r§7damage.".toPattern(), + "§cYou need a tool with a §r§aBreaking Power §r§cof §r§6(\\d)§r§c to mine (.*)§r§c! Speak to §r§dFragilis §r§cby the entrance to the Crystal Hollows to learn more!".toPattern() ) private val annoyingSpamMessages = listOf( "§cThere are blocks in the way!", @@ -256,6 +261,19 @@ class ChatFilter { "§6§lGOOD CATCH! §r§bYou found a §r§fLight Bait§r§b.", "§6§lGOOD CATCH! §r§bYou found a §r§aHot Bait§r§b.", "§6§lGOOD CATCH! §r§bYou found a §r§fSpooky Bait§r§b.", + "§bNew day! §r§eYour §r§2Sky Mall §r§ebuff changed!", + "§8§oYou can disable this messaging by toggling Sky Mall in your /hotm!", + "§e[NPC] Jacob§f: §rMy contest has started!", + ) + + private val anitaFortunePattern by RepoPattern.pattern( + "chat.jacobevent.accessory", + "§e\\[NPC] Jacob§f: Your §9Anita's (\\w+) §fis giving you §6\\+(\\d{1,2})☘ (\\w+) Fortune §fduring the contest!" + ) + + private val skymallPerkPattern by RepoPattern.pattern( + "chat.skymall.perk", + "§eNew buff§r§r§r:(.*)" ) // Winter Gift @@ -395,6 +413,8 @@ class ChatFilter { config.winterGift && message.isPresent("winter_gift") -> "winter_gift" config.powderMining && message.isPresent("powder_mining") -> "powder_mining" config.fireSale && message.isPresent("fire_sale") -> "fire_sale" + generalConfig.hideJacob && !GardenAPI.inGarden() && anitaFortunePattern.matches(message) -> "jacob_event" + generalConfig.hideSkyMall && !LorenzUtils.inMiningIsland() && skymallPerkPattern.matches(message) -> "skymall" else -> "" } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 502cba763..29700e684 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -370,4 +370,7 @@ object LorenzUtils { @Deprecated("moved", ReplaceWith("ChatUtils.sendMessageToServer(message)")) fun sendMessageToServer(message: String) = ChatUtils.sendMessageToServer(message) + + fun inMiningIsland() = IslandType.GOLD_MINES.isInIsland() || IslandType.DEEP_CAVERNS.isInIsland() + || IslandType.DWARVEN_MINES.isInIsland() || IslandType.CRYSTAL_HOLLOWS.isInIsland() } |