From 8c0536322f0eb686d537eb55e5ef4fe6a32789ef Mon Sep 17 00:00:00 2001 From: calmwolfs Date: Mon, 1 Jan 2024 21:47:00 -0500 Subject: [PATCH] migrate ArachneChatMessageHider --- .../features/chat/ArachneChatMessageHider.kt | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 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 index 72b28d013da3..f136c738bc37 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ArachneChatMessageHider.kt @@ -5,15 +5,26 @@ 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 at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ArachneChatMessageHider { private val config get() = SkyHanniMod.feature.chat private var hideArachneDeadMessage = false - // TODO USE SH-REPO - 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() + private val patternGroup = RepoPattern.group("chat.arachne") + private val arachneCallingPattern by patternGroup.pattern( + "calling", + "§4☄ §r.* §r§eplaced an §r§9Arachne's Calling§r§e!.*" + ) + private val arachneCrystalPattern by patternGroup.pattern( + "crystal", + "§4☄ §r.* §r§eplaced an Arachne Crystal! Something is awakening!" + ) + private val arachneSpawnPattern by patternGroup.pattern( + "spawn", + "§c\\[BOSS] Arachne§r§f: (?:The Era of Spiders begins now\\.|Ahhhh\\.\\.\\.A Calling\\.\\.\\.)" + ) @SubscribeEvent fun onChat(event: LorenzChatEvent) { @@ -35,8 +46,9 @@ class ArachneChatMessageHider { 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 + arachneSpawnPattern.matchMatcher(message) { + return true + } if (message == "§a§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬") { hideArachneDeadMessage = !hideArachneDeadMessage