Interface CooldownHandler<S extends Source>
- Type Parameters:
S- the sender-valueType
Cool-down checker and handler for the command usages
CommandUsage-
Method Summary
Modifier and TypeMethodDescriptionstatic <S extends Source>
CooldownHandler<S>createDefault(CommandUsage<S> usage) getLastTimeExecuted(S source) Fetches the last time the command source executed a specific command usageThe required of a usagedefault booleanhasCooldown(S source) Checks if there's a cooldown on the usage for a specific command sendervoidregisterExecutionMoment(S source) Sets the last time of execution to this current moment usingSystem.currentTimeMillis()voidremoveCooldown(S source) Unregisters the user's cached cooldown when it's expired!
-
Method Details
-
registerExecutionMoment
Sets the last time of execution to this current moment usingSystem.currentTimeMillis()- Parameters:
source- the command sender executing theCommandUsage
-
getUsageCooldown
Optional<UsageCooldown> getUsageCooldown()The required of a usage- Returns:
- the container of usage's cooldown, the container may be empty
-
hasCooldown
Checks if there's a cooldown on the usage for a specific command sender- Parameters:
source- the command sender/source- Returns:
- whether there's a current cooldown on the usage for the command sender
-
removeCooldown
Unregisters the user's cached cooldown when it's expired!- Parameters:
source- the command-sender
-
getLastTimeExecuted
Fetches the last time the command source executed a specific command usage- Parameters:
source- the command sender- Returns:
- the last time the sender executed
CommandUsage
-
createDefault
-