aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt6
2 files changed, 30 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt
index 5ef2b76b4..5cc007370 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt
@@ -35,18 +35,41 @@ object ProfileStorageData {
fun onProfileJoin(event: ProfileJoinEvent) {
val playerSpecific = playerSpecific
val sackPlayers = sackPlayers
+ val profileName = event.name
if (playerSpecific == null) {
+ workaroundIn10Seconds(profileName)
ErrorManager.skyHanniError("playerSpecific is null in ProfileJoinEvent!")
}
if (sackPlayers == null) {
ErrorManager.skyHanniError("sackPlayers is null in ProfileJoinEvent!")
}
- val profileName = event.name
loadProfileSpecific(playerSpecific, sackPlayers, profileName)
ConfigLoadEvent().postAndCatch()
}
+ private fun workaroundIn10Seconds(profileName: String) {
+ val playerSpecific = playerSpecific
+ val sackPlayers = sackPlayers
+
+ if (playerSpecific == null) {
+ ErrorManager.logErrorStateWithData(
+ "failed to load your profile data a second time",
+ "workaround in 10 seconds did not work"
+ )
+ ErrorManager.skyHanniError("playerSpecific is null in ProfileJoinEvent!")
+ }
+ if (sackPlayers == null) {
+ ErrorManager.skyHanniError("sackPlayers is null in ProfileJoinEvent!")
+ }
+ loadProfileSpecific(playerSpecific, sackPlayers, profileName)
+ ConfigLoadEvent().postAndCatch()
+ }
+
+ private fun runWorkaround() {
+
+ }
+
@SubscribeEvent
fun onTabListUpdate(event: TabListUpdateEvent) {
if (!LorenzUtils.inSkyBlock) return
diff --git a/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt
index e5ea5ab83..59a2529a0 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/DebugCommand.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.test
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.data.repo.RepoManager
import at.hannibal2.skyhanni.events.DebugDataCollectEvent
import at.hannibal2.skyhanni.utils.ChatUtils
@@ -64,6 +65,11 @@ object DebugCommand {
return
}
+ if (ProfileStorageData.playerSpecific == null) {
+ event.addData("playerSpecific is null!")
+ return
+ }
+
val classic = !LorenzUtils.noTradeMode
if (classic) {
event.addIrrelevant("on classic")