aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2023-10-18 06:53:01 +1100
committerGitHub <noreply@github.com>2023-10-17 21:53:01 +0200
commit60a68b0c0304447b0ef6c4f07dde5c4cd95b7f51 (patch)
tree00c6e24569afd19793bb3790df99cbd5046b1bf7 /src
parent5560763ae2481c84c63513d37b228855dfa7ee43 (diff)
downloadskyhanni-60a68b0c0304447b0ef6c4f07dde5c4cd95b7f51.tar.gz
skyhanni-60a68b0c0304447b0ef6c4f07dde5c4cd95b7f51.tar.bz2
skyhanni-60a68b0c0304447b0ef6c4f07dde5c4cd95b7f51.zip
oops (#600)
Fixed error with internal sacks data. #600
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt5
2 files changed, 14 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
index 08f9bb61d..aec0f27cc 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.SackItem.Companion.getStatus
import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
@@ -255,7 +256,7 @@ object SackAPI {
newAmount = 0
changed = 0
}
- sackData = sackData.editCopy { this[item.key] = SackItem(newAmount, changed, oldData.status) }
+ sackData = sackData.editCopy { this[item.key] = SackItem(newAmount, changed, oldData.getStatus()) }
} else {
val newAmount = if (item.value > 0) item.value else 0
sackData =
@@ -326,8 +327,14 @@ object SackAPI {
data class SackItem(
@Expose val amount: Long,
@Expose val lastChange: Int,
- @Expose val status: SackStatus = SackStatus.MISSING
-)
+ @Expose private val status: SackStatus?
+) {
+ companion object {
+ fun SackItem.getStatus(): SackStatus {
+ return status ?: SackStatus.MISSING
+ }
+ }
+}
private val gemstoneMap = mapOf(
"Jade Gemstones" to "ROUGH_JADE_GEM".asInternalName(),
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
index 38f95aa5f..c6b85b489 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.garden.composter
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.SackAPI
+import at.hannibal2.skyhanni.data.SackItem.Companion.getStatus
import at.hannibal2.skyhanni.data.SackStatus
import at.hannibal2.skyhanni.data.model.ComposterUpgrade
import at.hannibal2.skyhanni.events.GuiRenderEvent
@@ -456,7 +457,9 @@ class ComposterOverlay {
return
}
- val (amountInSacks, _, sackStatus) = SackAPI.fetchSackItem(internalName.asInternalName())
+ val sackItem = SackAPI.fetchSackItem(internalName.asInternalName())
+ val amountInSacks = sackItem.amount
+ val sackStatus = sackItem.getStatus()
if (sackStatus == SackStatus.MISSING || sackStatus == SackStatus.OUTDATED) {
if (sackStatus == SackStatus.OUTDATED) LorenzUtils.sendCommandToServer("gfs $internalName ${itemsNeeded - having}")