From dce6f7d065745e752b43a0d455041e4d80762bea Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Sun, 21 Jan 2024 00:00:05 +0100 Subject: Fix: Added cooldown to Garden Warp Commands (#941) Added cooldown to Garden Warp Commands. #941 --- .../hannibal2/skyhanni/features/garden/GardenWarpCommands.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt index a25949350..57e67b725 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenWarpCommands.kt @@ -1,19 +1,27 @@ package at.hannibal2.skyhanni.features.garden +import at.hannibal2.skyhanni.data.TitleManager import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.MessageSendToServerEvent +import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper +import at.hannibal2.skyhanni.features.event.diana.GriffinBurrowHelper import at.hannibal2.skyhanni.features.misc.LockMouseLook +import at.hannibal2.skyhanni.features.misc.trevor.TrevorFeatures import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.milliseconds +import kotlin.time.Duration.Companion.seconds class GardenWarpCommands { private val config get() = GardenAPI.config.gardenCommands // TODO repo private val tpPlotPattern = "/tp (?.*)".toPattern() + private var lastWarpTime = SimpleTimeMark.farPast() @SubscribeEvent fun onMessageSendToServer(event: MessageSendToServerEvent) { @@ -55,6 +63,8 @@ class GardenWarpCommands { else -> return } + if (lastWarpTime.passedSince() < 2.seconds) return + lastWarpTime = SimpleTimeMark.now() if (command == "tptoplot barn") { LockMouseLook.autoDisable() } -- cgit