diff options
author | appable <16139460+appable0@users.noreply.github.com> | 2024-06-20 14:06:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 23:06:17 +0200 |
commit | 681cec169fa8e92f2945d155bea996834246a8a6 (patch) | |
tree | 97555b2ad67edb9c689515c4cd6bdeaa0cab968d /src/main/java | |
parent | afcce659fac73e9c1d453a8b4d7f149bc4dd8e60 (diff) | |
download | skyhanni-681cec169fa8e92f2945d155bea996834246a8a6.tar.gz skyhanni-681cec169fa8e92f2945d155bea996834246a8a6.tar.bz2 skyhanni-681cec169fa8e92f2945d155bea996834246a8a6.zip |
Fix: Double Hook not detected with thunder bottle filled message (#2125)
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt | 18 |
1 files changed, 13 insertions, 5 deletions
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<String, SeaCreature>() var allVariants = mapOf<String, List<String>>() - 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() |