Class CooldownException

All Implemented Interfaces:
Serializable

public class CooldownException extends RuntimeException
Thrown when the CommandActor has to wait before executing a command again. This is set by Cooldown.
See Also:
  • Constructor Details

    • CooldownException

      public CooldownException(long timeLeft)
      Creates a new CooldownException with the given timestamp in milliseconds
      Parameters:
      timeLeft - The time left in milliseconds
    • CooldownException

      public CooldownException(TimeUnit unit, long timeLeft)
      Creates a new CooldownException with the given timestamp in any unit
      Parameters:
      unit - The time unit in which the time left is given
      timeLeft - 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

      public long getTimeLeft(@NotNull @NotNull TimeUnit unit)
      Returns the time left in the given unit
      Parameters:
      unit - Unit to convert to
      Returns:
      The time left