aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-11 03:46:54 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-11 03:46:54 +0200
commit6991c7375d35706b63f8d4347df72696cbdde860 (patch)
treed5a29fe2f7b1950bc9d70bc1123aaacfd15ef05a /src/main/java/at/hannibal2/skyhanni/data
parentf5bd9e61c3e70079ba08c0dd78db22f402023571 (diff)
downloadSkyHanni-6991c7375d35706b63f8d4347df72696cbdde860.tar.gz
SkyHanni-6991c7375d35706b63f8d4347df72696cbdde860.tar.bz2
SkyHanni-6991c7375d35706b63f8d4347df72696cbdde860.zip
Added support for custom hypixel ip addresses (looking at ilovecatgirls.xyz)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt44
1 files changed, 32 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
index cab37ecc0..d1f8d3317 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
@@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.utils.LorenzLogger
+import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.TabListData
import net.minecraft.client.Minecraft
@@ -15,7 +16,8 @@ import net.minecraftforge.fml.common.network.FMLNetworkEvent
class HypixelData {
companion object {
- var hypixel = false
+ var hypixelLive = false
+ var hypixelAlpha = false
var skyBlock = false
var skyBlockIsland = IslandType.UNKNOWN
@@ -38,13 +40,13 @@ class HypixelData {
private var loggerIslandChange = LorenzLogger("debug/island_change")
- @SubscribeEvent
- fun onConnect(event: FMLNetworkEvent.ClientConnectedToServerEvent) {
- hypixel = Minecraft.getMinecraft().runCatching {
- !event.isLocal && (thePlayer?.clientBrand?.lowercase()?.contains("hypixel")
- ?: currentServerData?.serverIP?.lowercase()?.contains("hypixel") ?: false)
- }.onFailure { it.printStackTrace() }.getOrDefault(false)
- }
+// @SubscribeEvent
+// fun onConnect(event: FMLNetworkEvent.ClientConnectedToServerEvent) {
+// hypixel = Minecraft.getMinecraft().runCatching {
+// !event.isLocal && (thePlayer?.clientBrand?.lowercase()?.contains("hypixel")
+// ?: currentServerData?.serverIP?.lowercase()?.contains("hypixel") ?: false)
+// }.onFailure { it.printStackTrace() }.getOrDefault(false)
+// }
@SubscribeEvent
fun onWorldChange(event: WorldEvent.Load) {
@@ -53,13 +55,14 @@ class HypixelData {
@SubscribeEvent
fun onDisconnect(event: FMLNetworkEvent.ClientDisconnectionFromServerEvent) {
- hypixel = false
+ hypixelLive = false
+ hypixelAlpha = false
skyBlock = false
}
@SubscribeEvent
fun onChatMessage(event: LorenzChatEvent) {
- if (!hypixel) return
+ if (!LorenzUtils.isHypixel) return
val message = event.message.removeColor().lowercase()
if (message.startsWith("your profile was changed to:")) {
@@ -79,13 +82,15 @@ class HypixelData {
@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
- if (!hypixel) return
if (event.phase != TickEvent.Phase.START) return
tick++
-
if (tick % 5 != 0) return
+ checkHypixel()
+
+ if (!LorenzUtils.isHypixel) return
+
val inSkyBlock = checkScoreboard()
if (inSkyBlock) {
checkIsland()
@@ -96,6 +101,21 @@ class HypixelData {
skyBlock = inSkyBlock
}
+ private fun checkHypixel() {
+ val list = ScoreboardData.sidebarLinesFormatted
+ if (list.isEmpty()) return
+
+ val last = list.last()
+ hypixelLive = last == "§ewww.hypixel.net"
+ hypixelAlpha = last == "§ealpha.hypixel.net"
+
+ println("")
+ println("hypixelLive: $hypixelLive")
+ println("hypixelAlpha: $hypixelAlpha")
+ println("last: '$last'")
+
+ }
+
private fun checkSidebar() {
ironman = false
stranded = false