Interface CooldownRepository
public interface CooldownRepository
Stores when each player's cooldowns run out. Entries live in memory and are mirrored to the
other servers so a cooldown cannot be dodged by switching server.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordIdentifies one cooldown by a player and the thing they are waiting on. -
Method Summary
Modifier and TypeMethodDescriptionlonggetTimeLeft(UUID playerUUID, Cooldown cooldown, String cooldownOwner) How long a player must still wait, starting a new window when the old one has run out.voidTells the other servers about a cooldown that just started here.booleanupdateCache(UUID playerUUID, String cooldownClass, long newExpireTime) Records an expiry time that arrived from another server.
-
Method Details
-
getTimeLeft
How long a player must still wait, starting a new window when the old one has run out.- Parameters:
playerUUID- the playercooldown- the cooldown settingscooldownOwner- what the cooldown applies to- Returns:
- the remaining milliseconds, or 0 if the player may act now
-
updateCache
Records an expiry time that arrived from another server.- Parameters:
playerUUID- the playercooldownClass- what the cooldown applies tonewExpireTime- when it runs out, in milliseconds- Returns:
- true if the stored value changed
-
syncProxy
-