aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-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}")