Skip to content

Commit

Permalink
change: set cooldown for dice1 item
Browse files Browse the repository at this point in the history
  • Loading branch information
acrylic-style committed Feb 9, 2024
1 parent 4c96748 commit f630236
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "net.azisaba"
version = "6.9.4"
version = "6.9.5"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import org.bukkit.event.Listener
import org.bukkit.event.block.Action
import org.bukkit.event.player.PlayerInteractEvent
import java.security.SecureRandom
import java.util.UUID

class Dice1ItemListener(val plugin: LifeCore) : Listener {
private val random = SecureRandom()
private val itemId = "b46ed137-a581-4ee8-b714-c1e136d141f2"
private val prefix = "§f§l【§6§l抽選§f§l】"
private val cooldown = mutableSetOf<UUID>()

@EventHandler
fun onPlayerInteract(e: PlayerInteractEvent) {
Expand All @@ -25,6 +27,13 @@ class Dice1ItemListener(val plugin: LifeCore) : Listener {
// wrong item
return
}
if (cooldown.contains(e.player.uniqueId)) {
return
}
cooldown.add(e.player.uniqueId)
Bukkit.getScheduler().runTaskLater(plugin, Runnable {
cooldown.remove(e.player.uniqueId)
}, 20 * 5)
fun rollNow() {
val randomPlayer =
e.player
Expand Down

0 comments on commit f630236

Please sign in to comment.