Package revxrsal.commands.exception
Class CooldownException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
revxrsal.commands.exception.CooldownException
- All Implemented Interfaces:
Serializable
Thrown when the
CommandActor
has to wait before executing a
command again. This is set by Cooldown
.- See Also:
-
Constructor Summary
ConstructorDescriptionCooldownException
(long timeLeft) Creates a newCooldownException
with the given timestamp in millisecondsCooldownException
(TimeUnit unit, long timeLeft) Creates a newCooldownException
with the given timestamp in any unit -
Method Summary
Modifier and TypeMethodDescriptionlong
getTimeLeft
(@NotNull TimeUnit unit) Returns the time left in the given unitlong
Returns the time left before being able to execute againMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
CooldownException
public CooldownException(long timeLeft) Creates a newCooldownException
with the given timestamp in milliseconds- Parameters:
timeLeft
- The time left in milliseconds
-
CooldownException
Creates a newCooldownException
with the given timestamp in any unit- Parameters:
unit
- The time unit in which the time left is giventimeLeft
- The time left in the given unit
-
-
Method Details
-
getTimeLeftMillis
public long getTimeLeftMillis()Returns the time left before being able to execute again- Returns:
- Time left in milliseconds
-
getTimeLeft
Returns the time left in the given unit- Parameters:
unit
- Unit to convert to- Returns:
- The time left
-