From 8dcd991f418b8027b9e42b3afb87f28fbbe9c19a Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 21 Mar 2023 19:28:32 +0100 Subject: Fixed visitor data gets lost sometimes after world switch --- .../at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt index 1c7763f57..fb08d212c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawString import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.removeColor import io.github.moulberry.notenoughupdates.events.SlotClickEvent +import io.github.moulberry.notenoughupdates.util.SBInfo import net.minecraft.client.Minecraft import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand @@ -296,7 +297,10 @@ class GardenVisitorFeatures { visitorsInTab.add(name) } } - if (visitors.keys.removeIf { it !in visitorsInTab }) { + if (visitors.keys.removeIf { + val time = System.currentTimeMillis() - SBInfo.getInstance().joinedWorld + it !in visitorsInTab && time > 2_000 + }) { updateDisplay() } for (name in visitorsInTab) { -- cgit