aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-09 20:13:12 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-09 20:13:12 +0100
commit22747a9b72e36c51cec634a41123c3415c13e36c (patch)
tree00a67d3491e384a4ed8866acd054a46da2a6b0ae /src/main/java/at/hannibal2/skyhanni/utils
parent861cbd33e56ecb32d464234ebb651f0b13cba17b (diff)
downloadskyhanni-22747a9b72e36c51cec634a41123c3415c13e36c.tar.gz
skyhanni-22747a9b72e36c51cec634a41123c3415c13e36c.tar.bz2
skyhanni-22747a9b72e36c51cec634a41123c3415c13e36c.zip
added dirty flag
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt
index 73bba2b51..fe2553c7f 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt
@@ -23,6 +23,7 @@ class SkyHanniTracker<Data : TrackerData>(
private val currentSessions = mutableMapOf<Storage.ProfileSpecific, Data>()
private var display = emptyList<List<Any>>()
private var sessionResetTime = SimpleTimeMark.farPast()
+ private var dirty = false
fun isInventoryOpen() = inventoryOpen
@@ -52,13 +53,18 @@ class SkyHanniTracker<Data : TrackerData>(
update()
}
+ if (dirty) {
+ display = getSharedTracker()?.let {
+ buildFinalDisplay(drawDisplay(it.get(displayMode)))
+ } ?: emptyList()
+ dirty = false
+ }
+
position.renderStringsAndItems(display, posLabel = name)
}
fun update() {
- display = getSharedTracker()?.let {
- buildFinalDisplay(drawDisplay(it.get(displayMode)))
- } ?: emptyList()
+ dirty = true
}
private fun buildFinalDisplay(rawList: List<List<Any>>) = rawList.toMutableList().also {