aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-05-24 20:01:22 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-05-24 20:01:22 +0200
commit103f9e3f0e8ae7b1c9eb4d89066e41279eb62a5c (patch)
treeb86299f7018c36e8ad166143d430a96c22f25fd9 /src
parentd862d086ca22e83b35aab0ecb1c10cd8dfb57d64 (diff)
downloadskyhanni-103f9e3f0e8ae7b1c9eb4d89066e41279eb62a5c.tar.gz
skyhanni-103f9e3f0e8ae7b1c9eb4d89066e41279eb62a5c.tar.bz2
skyhanni-103f9e3f0e8ae7b1c9eb4d89066e41279eb62a5c.zip
added workaround for playerSpecific is null error
Diffstat (limited to 'src')
-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")