summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/chat
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-19 12:44:25 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-19 12:44:25 +0200
commit4c9b2f977bda0aef5a7e714553d534b60b1ce308 (patch)
treec84138c5b4af65f1f9b192f7dfe89723569508b6 /src/main/java/at/hannibal2/skyhanni/features/chat
parent28745d981c1ed2008d4ebb71b0b69ba217c1770d (diff)
downloadskyhanni-4c9b2f977bda0aef5a7e714553d534b60b1ce308.tar.gz
skyhanni-4c9b2f977bda0aef5a7e714553d534b60b1ce308.tar.bz2
skyhanni-4c9b2f977bda0aef5a7e714553d534b60b1ce308.zip
Hide chat messages about the Arachne Fight while outside of Arachne's Sanctuary
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/chat')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt50
1 files changed, 50 insertions, 0 deletions
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
+}