From 86fbe3fbb96b27eef3f1a27dfd1505129ba52fd4 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 22 Jul 2023 03:02:39 +0200 Subject: fixed random bug --- .../java/at/hannibal2/skyhanni/data/HypixelData.kt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 1ee266cc4..84f8503e6 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -74,13 +74,7 @@ class HypixelData { .firstOrNull { it.startsWith(" §7⏣ ") || it.startsWith(" §5ф ") } ?.substring(5)?.removeColor() ?: "?" - if (profileName.isEmpty()) { - val text = TabListData.getTabList().first { it.contains("Profile:") } - tabListProfilePattern.matchMatcher(text) { - profileName = group("profile").lowercase() - ProfileJoinEvent(profileName).postAndCatch() - } - } + checkProfileName() } } @@ -104,6 +98,17 @@ class HypixelData { skyBlock = inSkyBlock } + private fun checkProfileName(): Boolean { + if (profileName.isEmpty()) { + val text = TabListData.getTabList().firstOrNull { it.contains("Profile:") } ?: return true + tabListProfilePattern.matchMatcher(text) { + profileName = group("profile").lowercase() + ProfileJoinEvent(profileName).postAndCatch() + } + } + return false + } + private fun checkHypixel() { val list = ScoreboardData.sidebarLinesFormatted if (list.isEmpty()) return -- cgit