diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt | 10 |
1 files changed, 8 insertions, 2 deletions
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() + } } } |