From cf42c5be22ef2502bfc11e809d989820fe2eefaf Mon Sep 17 00:00:00 2001 From: Lorenz Date: Fri, 15 Jul 2022 00:33:59 +0200 Subject: add hypixel api --- .../java/at/hannibal2/skyhanni/misc/HypixelData.kt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/misc/HypixelData.kt') diff --git a/src/main/java/at/hannibal2/skyhanni/misc/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/misc/HypixelData.kt index 29fa2a242..89db5edaf 100644 --- a/src/main/java/at/hannibal2/skyhanni/misc/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/misc/HypixelData.kt @@ -1,6 +1,9 @@ package at.hannibal2.skyhanni.misc +import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent +import at.hannibal2.skyhanni.utils.LorenzUtils.removeColorCodes import net.minecraft.client.Minecraft import net.minecraft.network.play.server.S38PacketPlayerListItem import net.minecraft.network.play.server.S3DPacketDisplayScoreboard @@ -60,4 +63,21 @@ class HypixelData { skyblock = false dungeon = false } + + @SubscribeEvent + fun onStatusBar(event: LorenzChatEvent) { + if (!hypixel) return + + val message = event.message.removeColorCodes().lowercase() + + if (message.startsWith("your profile was changed to:")) { + val stripped = message.replace("your profile was changed to:", "").replace("(co-op)", "").trim(); + ProfileJoinEvent(stripped).postAndCatch() + } + if (message.startsWith("you are playing on profile:")) { + val stripped = message.replace("you are playing on profile:", "").replace("(co-op)", "").trim(); + ProfileJoinEvent(stripped).postAndCatch() + + } + } } \ No newline at end of file -- cgit