From 071a215e9f55b2bf90bcdc8be5fc25ae9fe981cb Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 9 Dec 2023 01:41:59 +0100 Subject: Prevent spamming the command /shclearcontestdata --- .../java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index 391680208..ed87e6da7 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -38,6 +38,7 @@ import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils import kotlinx.coroutines.launch import net.minecraft.client.Minecraft @@ -47,6 +48,7 @@ import net.minecraftforge.client.event.GuiScreenEvent import net.minecraftforge.common.MinecraftForge import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.io.File +import kotlin.time.Duration.Companion.seconds class SkyHanniDebugsAndTests { @@ -260,7 +262,15 @@ class SkyHanniDebugsAndTests { LorenzUtils.chat("§eYou are not in Skyblock.") } + private var lastManualContestDataUpdate = SimpleTimeMark.farPast() + fun clearContestData() { + if (lastManualContestDataUpdate.passedSince() < 30.seconds) { + LorenzUtils.userError("§cYou already cleared Jacob's Contest data recently!") + return + } + lastManualContestDataUpdate = SimpleTimeMark.now() + GardenNextJacobContest.contests.clear() GardenNextJacobContest.fetchedFromElite = false GardenNextJacobContest.isFetchingContests = true -- cgit