aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-10 13:03:01 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-10 13:03:01 +0200
commitb8b14237d4d034c97f10f1bbb4fab4e79efbcc03 (patch)
tree69d6dcbb32cc88efd20cd29e96fad7ec4f8de7fe /src/main/java/at/hannibal2/skyhanni/features
parent6fc895d8e5daaa6996bfa67f28a13294bfa5eea2 (diff)
downloadskyhanni-b8b14237d4d034c97f10f1bbb4fab4e79efbcc03.tar.gz
skyhanni-b8b14237d4d034c97f10f1bbb4fab4e79efbcc03.tar.bz2
skyhanni-b8b14237d4d034c97f10f1bbb4fab4e79efbcc03.zip
added small delay
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarOpenPriceWebsite.kt10
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()
+ }
}
}