diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2023-09-15 18:46:09 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-15 10:46:09 +0200 |
commit | eebc1d00df5fa6cc56c09a1226ffa2a97d6af6f1 (patch) | |
tree | 1f302f11b133667a7c9216d23be259e5185748c9 /src/main/java/at | |
parent | c78ef258593969ea30fb6c38042b3e65acd91024 (diff) | |
download | skyhanni-eebc1d00df5fa6cc56c09a1226ffa2a97d6af6f1.tar.gz skyhanni-eebc1d00df5fa6cc56c09a1226ffa2a97d6af6f1.tar.bz2 skyhanni-eebc1d00df5fa6cc56c09a1226ffa2a97d6af6f1.zip |
Fix + Backend: Sack Save (#469)
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 1 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt | 8 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 4bb551f87..83ef3360f 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -423,7 +423,6 @@ class SkyHanniMod { initLogging() Runtime.getRuntime().addShutdownHook(Thread { configManager.saveConfig("shutdown-hook") - configManager.saveSackData("shutdown-hook") }) repo = RepoManager(configManager.configDirectory) try { diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt index e2102c6ec..89363fd7c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt @@ -270,20 +270,20 @@ object SackAPI { sackData = sackData.editCopy { this[item] = SackItem(amount, 0, 0) } } - fun fetchSackItem(item: NEUInternalName): SackItem? { + fun fetchSackItem(item: NEUInternalName): SackItem { sackData = ProfileStorageData.sackProfiles?.sackContents ?: return SackItem(0, 0, -1) if (sackData.containsKey(item)) { - return sackData[item] + return sackData[item] ?: return SackItem(0, 0, -1) } sackData = sackData.editCopy { this[item] = SackItem(0, 0, 2) } - return sackData[item] + return sackData[item] ?: return SackItem(0, 0, -1) } private fun saveSackData() { ProfileStorageData.sackProfiles?.sackContents = sackData - SkyHanniMod.configManager.saveSackData("shutdown-hook") + SkyHanniMod.configManager.saveSackData("saving-data") } data class SackGemstone( |