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.StringableThis class is used to create and manage cooldowns
All cooldowns are removed when the server is restarted! They're only stored inCooldownManager.cooldowns
-
-
Constructor Summary
Constructors Constructor Description AnnoyingCooldown(@NotNull AnnoyingPlugin plugin, @NotNull java.lang.Object type, @NotNull java.lang.String key)Creates a new cooldown with the given type, key, and durationAnnoyingCooldown(@NotNull CooldownManager manager, @NotNull java.lang.Object type, @NotNull java.lang.String key)Creates a new cooldown with the given type, key, and duration
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(@Nullable java.lang.Object other)longgetRemaining()Alongof the time remaining on the cooldowninthashCode()booleanisOnCooldown()Checks if the cooldown is still goingbooleanisOnCooldownStart(long duration)Checks if the cooldown is still going
If it isn't, it willstart the cooldownbooleanisOnCooldownStop()Checks 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 cooldown
-
-
-
Constructor Detail
-
AnnoyingCooldown
public AnnoyingCooldown(@NotNull @NotNull CooldownManager manager, @NotNull @NotNull java.lang.Object type, @NotNull @NotNull java.lang.String key)Creates a new cooldown with the given type, key, and duration
-
AnnoyingCooldown
public AnnoyingCooldown(@NotNull @NotNull AnnoyingPlugin plugin, @NotNull @NotNull java.lang.Object type, @NotNull @NotNull java.lang.String key)Creates a new cooldown with the given type, key, and duration
-
-
Method Detail
-
getRemaining
public long getRemaining()
Alongof the time remaining on the cooldown- Returns:
- amount of time left in the cooldown (in milliseconds)
- See Also:
DurationFormatter.formatDuration(long, String, boolean)
-
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
public boolean equals(@Nullable @Nullable java.lang.Object other)- Overrides:
equalsin classjava.lang.Object- Parameters:
other- the object to compare to- Returns:
- whether the object is equal to this cooldown
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash code of this cooldown
-
-