From 22747a9b72e36c51cec634a41123c3415c13e36c Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 9 Nov 2023 20:13:12 +0100 Subject: added dirty flag --- .../at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') 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( private val currentSessions = mutableMapOf() private var display = emptyList>() private var sessionResetTime = SimpleTimeMark.farPast() + private var dirty = false fun isInventoryOpen() = inventoryOpen @@ -52,13 +53,18 @@ class SkyHanniTracker( 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>) = rawList.toMutableList().also { -- cgit