CooldownHandler

Handles cooldowns for players and guilds.

Constructors

Link copied to clipboard
open fun CooldownHandler(guilds: Guilds)
Creates a new instance of the CooldownHandler class.

Functions

Link copied to clipboard
open fun addCooldown(@NotNull cooldownType: @NotNull Cooldown.Type, @NotNull cooldownOwner: @NotNull UUID, length: Int, @NotNull timeUnit: @NotNull TimeUnit)
Adds a cooldown.
open fun addCooldown(@NotNull guild: @NotNull Guild, @NotNull type: @NotNull String, length: Int, @NotNull timeUnit: @NotNull TimeUnit)
Adds a guild to the cooldown.
open fun addCooldown(@NotNull player: @NotNull OfflinePlayer, @NotNull type: @NotNull String, length: Int, @NotNull timeUnit: @NotNull TimeUnit)
Adds a player to the cooldown.
Link copied to clipboard
open fun getCooldown(@NotNull cooldownType: @NotNull Cooldown.Type, @NotNull cooldownOwner: @NotNull UUID): Cooldown
Gets a cooldown from the list.
Link copied to clipboard
open fun getRemaining(@NotNull cooldownType: @NotNull String, @NotNull cooldownOwner: @NotNull UUID): Int
Get the remaining time of the cooldown.
open fun getRemaining(@NotNull cooldownType: @NotNull Cooldown.Type, @NotNull cooldownOwner: @NotNull UUID): Int
Get the remaining time of the cooldown in seconds.
Link copied to clipboard
open fun hasCooldown(@NotNull cooldownType: @NotNull String, @NotNull cooldownOwner: @NotNull UUID): Boolean
Checks if a cooldown is still valid.
open fun hasCooldown(@NotNull cooldownType: @NotNull Cooldown.Type, @NotNull cooldownOwner: @NotNull UUID): Boolean
Check if a cooldown is still valid
Link copied to clipboard
open fun loadCooldowns()
Loads all the cooldowns from the database when the plugin first enables.
Link copied to clipboard
open fun saveCooldowns()
Saves all the cooldowns to the database.

Properties

Link copied to clipboard
val cooldowns: ExpiringMap<UUID, Cooldown>