From c9938504234a1291ee53515bd296e75daeecbd3d Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 28 Sep 2024 21:54:47 +0200 Subject: Fix: Custom Scoreboard Active Tablist Event (#2592) --- .../features/gui/customscoreboard/ScoreboardEvent.kt | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt index 3b3b6448b..68dba3eee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.gui.customscoreboard import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.model.TabWidget import at.hannibal2.skyhanni.features.combat.SpidersDenAPI.isAtTopOfNest import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.eventsConfig @@ -13,6 +14,7 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.LorenzUtils.inAdvancedMiningIsland import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.RegexUtils.anyMatches +import at.hannibal2.skyhanni.utils.RegexUtils.firstMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -411,12 +413,9 @@ private fun getActiveEventLine(): List { val blockedEvents = listOf("Spooky Festival", "Carnival", "5th SkyBlock Anniversary", "New Year Celebration") if (blockedEvents.contains(currentActiveEvent.removeColor())) return emptyList() - val currentActiveEventTime = TabListData.getTabList().firstOrNull { SbPattern.eventTimeEndsPattern.matches(it) } - ?.let { - SbPattern.eventTimeEndsPattern.matchMatcher(it) { - group("time") - } - } + val currentActiveEventTime = ScoreboardPattern.eventTimeEndsPattern.firstMatcher(TabWidget.EVENT.lines) { + group("time") + } ?: return emptyList() return listOf(currentActiveEvent, " Ends in: §e$currentActiveEventTime") } @@ -426,12 +425,9 @@ private fun getActiveEventShowWhen(): Boolean = private fun getSoonEventLine(): List { val soonActiveEvent = getTablistEvent() ?: return emptyList() - val soonActiveEventTime = TabListData.getTabList().firstOrNull { SbPattern.eventTimeStartsPattern.matches(it) } - ?.let { - SbPattern.eventTimeStartsPattern.matchMatcher(it) { - group("time") - } - } + val soonActiveEventTime = ScoreboardPattern.eventTimeStartsPattern.firstMatcher(TabWidget.EVENT.lines) { + group("time") + } ?: return emptyList() return listOf(soonActiveEvent, " Starts in: §e$soonActiveEventTime") } -- cgit