aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/misc/HypixelData.kt
diff options
context:
space:
mode:
authorLorenz <ESs95s3P5z8Pheb>2022-07-15 00:33:59 +0200
committerLorenz <ESs95s3P5z8Pheb>2022-07-15 00:33:59 +0200
commitcf42c5be22ef2502bfc11e809d989820fe2eefaf (patch)
treea2da1b1a20dc7f566a0a5413adab54c5fbfc5952 /src/main/java/at/hannibal2/skyhanni/misc/HypixelData.kt
parent0fa564604a99400e91385dec37753345174c45e0 (diff)
downloadskyhanni-cf42c5be22ef2502bfc11e809d989820fe2eefaf.tar.gz
skyhanni-cf42c5be22ef2502bfc11e809d989820fe2eefaf.tar.bz2
skyhanni-cf42c5be22ef2502bfc11e809d989820fe2eefaf.zip
add hypixel api
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/misc/HypixelData.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/misc/HypixelData.kt20
1 files changed, 20 insertions, 0 deletions
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