aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt18
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()