diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-21 21:11:43 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-21 21:11:43 +0200 |
commit | fc6e7c4d7c7d4c535141c1bb15225e0f98660894 (patch) | |
tree | ad228f8c0ba2d0f998c825f53a4e3a2b00e50b27 /src/main/java/at/hannibal2 | |
parent | 3348fc30feb4a4c2d375e87de4b028d6fb4b58c5 (diff) | |
download | skyhanni-fc6e7c4d7c7d4c535141c1bb15225e0f98660894.tar.gz skyhanni-fc6e7c4d7c7d4c535141c1bb15225e0f98660894.tar.bz2 skyhanni-fc6e7c4d7c7d4c535141c1bb15225e0f98660894.zip |
Fixed profile name not detecting correctly when only one profile exists
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 7c017f8c5..1ee266cc4 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TabListData import net.minecraft.client.Minecraft @@ -11,6 +12,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.network.FMLNetworkEvent class HypixelData { + private val tabListProfilePattern = "§e§lProfile: §r§a(?<profile>.*)".toPattern() companion object { var hypixelLive = false @@ -72,6 +74,13 @@ 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() + } + } } } |