From 388819e61cf1229ef4a5d6ddeca1bd1dafd05e71 Mon Sep 17 00:00:00 2001 From: Luna Date: Fri, 12 Apr 2024 14:13:31 +0200 Subject: Fix: Clear SkyBlock area on world change (#1421) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt | 8 ++++++-- .../features/event/lobby/waypoints/easter/EasterEggWaypoints.kt | 3 --- .../skyhanni/features/gui/customscoreboard/ScoreboardElements.kt | 2 +- .../hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt | 2 +- src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 8df208c95..7db5c9a89 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -112,8 +112,8 @@ class HypixelData { var profileName = "" var joinedWorld = SimpleTimeMark.farPast() - var skyBlockArea = "?" - var skyBlockAreaWithSymbol = "?" + var skyBlockArea: String? = null + var skyBlockAreaWithSymbol: String? = null // Data from locraw var locrawData: JsonObject? = null @@ -229,6 +229,8 @@ class HypixelData { locraw.forEach { locraw[it.key] = "" } joinedWorld = SimpleTimeMark.now() serverId = null + skyBlockArea = null + skyBlockAreaWithSymbol = null } @SubscribeEvent @@ -239,6 +241,8 @@ class HypixelData { inLobby = false locraw.forEach { locraw[it.key] = "" } locrawData = null + skyBlockArea = null + skyBlockAreaWithSymbol = null } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt index 4fc8d40f4..0017e9098 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt @@ -75,10 +75,7 @@ class EasterEggWaypoints { event.drawWaypointFilled(eggEntrance.waypoint, LorenzColor.YELLOW.toColor()) event.drawDynamicText(eggEntrance.waypoint, "§e" + eggEntrance.eggEntranceName, 1.5) } - return } - - if (LorenzUtils.skyBlockArea == "?") return } private fun EasterEgg.shouldShow(): Boolean { diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index 2bf173ab9..6de6ea4f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -483,7 +483,7 @@ private fun getIslandDisplayPair() = listOf("§7㋖ §a" + HypixelData.skyBlockIsland.displayName to HorizontalAlignment.LEFT) private fun getLocationDisplayPair() = buildList { - add(HypixelData.skyBlockAreaWithSymbol to HorizontalAlignment.LEFT) + HypixelData.skyBlockAreaWithSymbol?.let { add(it to HorizontalAlignment.LEFT) } ScoreboardData.sidebarLinesFormatted.firstOrNull { ScoreboardPattern.plotPattern.matches(it) } ?.let { add(it to HorizontalAlignment.LEFT) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt index e5741807b..77e854646 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt @@ -58,7 +58,7 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier?) NONE(null), LOCATION({ - var location = LorenzUtils.skyBlockArea + var location = LorenzUtils.skyBlockArea ?: "invalid" val island = LorenzUtils.skyBlockIsland if (location == "Your Island") location = "Private Island" diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index bf258dab9..7e349aa9f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -58,7 +58,7 @@ object LorenzUtils { */ val skyBlockIsland get() = HypixelData.skyBlockIsland - val skyBlockArea get() = if (inSkyBlock) HypixelData.skyBlockArea else "?" + val skyBlockArea get() = if (inSkyBlock) HypixelData.skyBlockArea else null val inKuudraFight get() = inSkyBlock && KuudraAPI.inKuudra() -- cgit