From b8b14237d4d034c97f10f1bbb4fab4e79efbcc03 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 10 Sep 2023 13:03:01 +0200 Subject: added small delay --- .../skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt index 2fc37e12c..b39809125 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt @@ -4,15 +4,18 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.OSUtils +import at.hannibal2.skyhanni.utils.SimpleTimeMark import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent import io.github.moulberry.notenoughupdates.events.SlotClickEvent import io.github.moulberry.notenoughupdates.util.Utils import net.minecraft.entity.player.InventoryPlayer import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds class BazaarOpenPriceWebsite { private val config get() = SkyHanniMod.feature.bazaar + private var lastClick = SimpleTimeMark.farPast() private val item by lazy { val neuItem = NEUItems.getItemStack("PAPER", true) @@ -43,8 +46,11 @@ class BazaarOpenPriceWebsite { if (event.slotId == 22) { event.isCanceled = true - val name = getSkyBlockBzName(lastItem) - OSUtils.openBrowser("https://www.skyblock.bz/product/$name") + if (lastClick.passedSince() > 0.3.seconds) { + val name = getSkyBlockBzName(lastItem) + OSUtils.openBrowser("https://www.skyblock.bz/product/$name") + lastClick = SimpleTimeMark.now() + } } } -- cgit