Package xyz.srnyx.annoyingapi.cooldown
Class AnnoyingCooldown
java.lang.Object
xyz.srnyx.javautilities.parents.Stringable
xyz.srnyx.annoyingapi.cooldown.AnnoyingCooldown
public class AnnoyingCooldown
extends xyz.srnyx.javautilities.parents.Stringable
This class is used to create and manage cooldowns
All cooldowns are removed when the server is restarted! They're only stored in
All cooldowns are removed when the server is restarted! They're only stored in
CooldownManager.cooldowns-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAnnoyingCooldown(@NotNull AnnoyingPlugin plugin, @NotNull Object type, @NotNull String key) Creates a new cooldown with the given type, key, and durationAnnoyingCooldown(@NotNull CooldownManager manager, @NotNull Object type, @NotNull String key) Creates a new cooldown with the given type, key, and duration -
Method Summary
Modifier and TypeMethodDescriptionbooleanlongAlongof the time remaining on the cooldowninthashCode()booleanChecks if the cooldown is still goingbooleanisOnCooldownStart(long duration) Checks if the cooldown is still going
If it isn't, it willstart the cooldownbooleanChecks if the cooldown is still going
If it is, it willstop the cooldownvoidstart(long duration) Starts the cooldown
If the cooldown is already started, it will be restartedvoidstop()Stops the cooldownMethods inherited from class xyz.srnyx.javautilities.parents.Stringable
toString, toString, toString, toString, toString
-
Field Details
-
type
A string indicating the type of cooldown (examples:command.play,use_ability, etc...) -
key
The key that "owns" this cooldown (example: a player'sUUID)
-
-
Constructor Details
-
AnnoyingCooldown
public AnnoyingCooldown(@NotNull @NotNull CooldownManager manager, @NotNull @NotNull Object type, @NotNull @NotNull String key) Creates a new cooldown with the given type, key, and duration -
AnnoyingCooldown
public AnnoyingCooldown(@NotNull @NotNull AnnoyingPlugin plugin, @NotNull @NotNull Object type, @NotNull @NotNull String key) Creates a new cooldown with the given type, key, and duration
-
-
Method Details
-
getRemaining
public long getRemaining()Alongof the time remaining on the cooldown- Returns:
- amount of time left in the cooldown (in milliseconds)
- See Also:
-
isOnCooldown
public boolean isOnCooldown()Checks if the cooldown is still going- Returns:
- whether the cooldown is still going
-
isOnCooldownStart
public boolean isOnCooldownStart(long duration) Checks if the cooldown is still going
If it isn't, it willstart the cooldown- Parameters:
duration- the duration of the cooldown (in milliseconds)- Returns:
- whether the cooldown was still going
-
isOnCooldownStop
public boolean isOnCooldownStop()Checks if the cooldown is still going
If it is, it willstop the cooldown- Returns:
- whether the cooldown was still going
-
start
public void start(long duration) Starts the cooldown
If the cooldown is already started, it will be restarted- Parameters:
duration- the duration of the cooldown (in milliseconds)
-
stop
public void stop()Stops the cooldown -
equals
-
hashCode
public int hashCode()
-