From b5977b31bc5244d047c7963a727c43047e5e2203 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 31 Jan 2024 20:28:47 +0100 Subject: fixed dungeon api using two chat events --- .../skyhanni/features/dungeon/DungeonAPI.kt | 35 ++++++++++------------ 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt index f9403af94..c1d8415e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt @@ -136,14 +136,21 @@ class DungeonAPI { @SubscribeEvent fun onChat(event: LorenzChatEvent) { - val floor = dungeonFloor - if (floor != null) { - if (event.message == "§e[NPC] §bMort§f: §rHere, I found this map when I first entered the dungeon.") { - started = true - DungeonStartEvent(floor).postAndCatch() - } - if (event.message.removeColor().matches(uniqueClassBonus)) { - isUniqueClass = true + val floor = dungeonFloor ?: return + if (event.message == "§e[NPC] §bMort§f: §rHere, I found this map when I first entered the dungeon.") { + started = true + DungeonStartEvent(floor).postAndCatch() + } + if (event.message.removeColor().matches(uniqueClassBonus)) { + isUniqueClass = true + } + + if (!LorenzUtils.inSkyBlock) return + killPattern.matchMatcher(event.message.removeColor()) { + val bossCollections = bossStorage ?: return + val boss = DungeonFloor.byBossName(group("boss")) + if (matches() && boss != null && boss !in bossCollections) { + bossCollections.addOrPut(boss, 1) } } } @@ -209,18 +216,6 @@ class DungeonAPI { } } - @SubscribeEvent - fun onChat(event: LorenzChatEvent) { - if (!LorenzUtils.inDungeons) return - killPattern.matchMatcher(event.message.removeColor()) { - val bossCollections = bossStorage ?: return - val boss = DungeonFloor.byBossName(group("boss")) - if (matches() && boss != null && boss !in bossCollections) { - bossCollections.addOrPut(boss, 1) - } - } - } - @SubscribeEvent fun onDebugDataCollect(event: DebugDataCollectEvent) { event.title("Dungeon") -- cgit