diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingCollectionDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingCollectionDisplay.kt index 1472d693e6df..811421456c21 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingCollectionDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingCollectionDisplay.kt @@ -38,6 +38,7 @@ import kotlinx.coroutines.launch import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.UUID import kotlin.time.Duration.Companion.minutes +import kotlin.time.Duration.Companion.seconds object FarmingCollectionDisplay { @@ -45,6 +46,7 @@ object FarmingCollectionDisplay { private var checkDuration = 10.minutes private var worldSwapRefresh = true + private var settingToggleCooldown = SimpleTimeMark.farPast() @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { @@ -78,7 +80,6 @@ object FarmingCollectionDisplay { private var display = emptyList() - @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent) { if (GardenAPI.hideExtraGuis()) return @@ -98,7 +99,10 @@ object FarmingCollectionDisplay { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { config.crop.afterChange { - lastLeaderboardFetch = SimpleTimeMark.farPast() + if (settingToggleCooldown.passedSince() < 30.seconds) { + settingToggleCooldown = SimpleTimeMark.now() + lastLeaderboardFetch = SimpleTimeMark.farPast() + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillRankDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillRankDisplay.kt index 2e6b1c02e09b..a12862f26eef 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillRankDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillRankDisplay.kt @@ -41,6 +41,7 @@ object SkillRankDisplay { private var checkDuration = 10.minutes private var worldSwapRefresh = true + private var settingToggleCooldown = SimpleTimeMark.farPast() @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { @@ -86,7 +87,10 @@ object SkillRankDisplay { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { config.skill.afterChange { - lastLeaderboardFetch = SimpleTimeMark.farPast() + if (settingToggleCooldown.passedSince() < 30.seconds) { + settingToggleCooldown = SimpleTimeMark.now() + lastLeaderboardFetch = SimpleTimeMark.farPast() + } } }