From 4c9b2f977bda0aef5a7e714553d534b60b1ce308 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 19 Jun 2023 12:44:25 +0200 Subject: Hide chat messages about the Arachne Fight while outside of Arachne's Sanctuary --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 + .../hannibal2/skyhanni/config/features/Chat.java | 7 ++- .../features/chat/ArachneChatMessageHider.kt | 50 ++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 0021299fa..ebe7d2686 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.features.bazaar.BazaarBestSellMethod import at.hannibal2.skyhanni.features.bazaar.BazaarCancelledBuyOrderClipboard import at.hannibal2.skyhanni.features.bazaar.BazaarOrderHelper import at.hannibal2.skyhanni.features.bingo.* +import at.hannibal2.skyhanni.features.chat.ArachneChatMessageHider import at.hannibal2.skyhanni.features.chat.ChatFilter import at.hannibal2.skyhanni.features.chat.PlayerDeathMessages import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFilter @@ -295,6 +296,7 @@ class SkyHanniMod { loadModule(DetectBrokenHyperion()) loadModule(RestorePieceOfWizardPortalLore()) loadModule(QuickModMenuSwitch) + loadModule(ArachneChatMessageHider()) loadModule(ShowItemUuid()) loadModule(SlayerRngMeterDisplay()) loadModule(GhostCounter) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java index bd60e0eee..f149fc624 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java @@ -122,10 +122,15 @@ public class Chat { "except for players who are nearby or during dungeons/a Kuudra fight.") @ConfigEditorBoolean public boolean hideFarDeathMessages = false; - //TODO jawbus + x + //TODO jawbus + thunder @Expose @ConfigOption(name = "Compact Potion Message", desc = "Shorten chat messages about player potion effects.") @ConfigEditorBoolean public boolean compactPotionMessage = true; + + @Expose + @ConfigOption(name = "Arachne Hider", desc = "Hide chat messages about the Arachne Fight while outside of §eArachne's Sanctuary§7.") + @ConfigEditorBoolean + public boolean hideArachneMessages = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt new file mode 100644 index 000000000..d870197c7 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt @@ -0,0 +1,50 @@ +package at.hannibal2.skyhanni.features.chat + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class ArachneChatMessageHider { + private val config get() = SkyHanniMod.feature.chat + private var hideArachneDeadMessage = false + private val arachneCallingPattern = "§4☄ §r.* §r§eplaced an §r§9Arachne's Calling§r§e!.*".toPattern() + private val arachneCrystalPattern = "§4☄ §r.* §r§eplaced an Arachne Crystal! Something is awakening!".toPattern() + + @SubscribeEvent + fun onChat(event: LorenzChatEvent) { + if (!isEnabled()) return + if (LorenzUtils.skyBlockIsland != IslandType.SPIDER_DEN) return + if (LorenzUtils.skyBlockArea == "Arachne's Sanctuary") return + + if (shouldHide(event.message)) { + event.blockedReason = "arachne" + } + } + + private fun shouldHide(message: String): Boolean { + + arachneCallingPattern.matchMatcher(message) { + return true + } + arachneCrystalPattern.matchMatcher(message) { + return true + } + + if (message == "§c[BOSS] Arachne§r§f: Ahhhh...A Calling...") return true + if (message == "§c[BOSS] Arachne§r§f: The Era of Spiders begins now.") return true + + if (message == "§a§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬") { + hideArachneDeadMessage = !hideArachneDeadMessage + return true + } + if (message == " §r§6§lARACHNE DOWN!") { + hideArachneDeadMessage = true + } + return hideArachneDeadMessage + } + + fun isEnabled() = LorenzUtils.inSkyBlock && config.hideArachneMessages +} -- cgit