From 681cec169fa8e92f2945d155bea996834246a8a6 Mon Sep 17 00:00:00 2001 From: appable <16139460+appable0@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:06:17 -0700 Subject: Fix: Double Hook not detected with thunder bottle filled message (#2125) --- .../skyhanni/features/fishing/SeaCreatureManager.kt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt index b665cf7bc..79c713b87 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt @@ -7,6 +7,8 @@ import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.events.SeaCreatureFishEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RegexUtils.matches +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule @@ -18,20 +20,26 @@ object SeaCreatureManager { var allFishingMobs = mapOf() var allVariants = mapOf>() - private val doubleHookMessages = setOf( - "§eIt's a §r§aDouble Hook§r§e! Woot woot!", - "§eIt's a §r§aDouble Hook§r§e!" + private val patternGroup = RepoPattern.group("fishing.seacreature") + + private val doubleHookPattern by patternGroup.pattern( + "doublehook", + "§eIt's a §r§aDouble Hook§r§e!(?: Woot woot!)?" + ) + private val thunderBottleChargedPattern by patternGroup.pattern( + "thundercharged", + "§e> Your bottle of thunder has fully charged!" ) @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return - if (doubleHookMessages.contains(event.message)) { + if (doubleHookPattern.matches(event.message)) { if (SkyHanniMod.feature.fishing.compactDoubleHook) { event.blockedReason = "double_hook" } doubleHook = true - } else { + } else if (!doubleHook || !thunderBottleChargedPattern.matches(event.message)) { val seaCreature = getSeaCreatureFromMessage(event.message) if (seaCreature != null) { SeaCreatureFishEvent(seaCreature, event, doubleHook).postAndCatch() -- cgit