Package xyz.srnyx.annoyingapi.cooldown
Class CooldownManager
java.lang.Object
xyz.srnyx.javautilities.parents.Stringable
xyz.srnyx.annoyingapi.cooldown.CooldownManager
public class CooldownManager
extends xyz.srnyx.javautilities.parents.Stringable
This class is used to manage all cooldowns
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull Optional<AnnoyingCooldown> getCooldown(@NotNull Object key, @NotNull Object type) Get a cooldown with the given key and type@NotNull AnnoyingCooldowngetCooldownElseNew(@NotNull Object key, @NotNull Object type) Get a cooldown with the given key and type
If the cooldown doesn't exist yet, it will create a new one with the given key and type (it won't start it though)@NotNull Set<AnnoyingCooldown> getCooldownsByKey(@NotNull Object key) Get all cooldowns with the given key@NotNull Set<AnnoyingCooldown> getCooldownsByType(@NotNull Object type) Get all cooldowns with the given typeMethods inherited from class xyz.srnyx.javautilities.parents.Stringable
toString, toString, toString, toString, toString
-
Field Details
-
cooldowns
A set of all cooldowns
-
-
Constructor Details
-
CooldownManager
public CooldownManager()Constructs a new cooldown manager
-
-
Method Details
-
getCooldownsByType
Get all cooldowns with the given type- Parameters:
type- the type of the cooldowns- Returns:
- all cooldowns with the given type
-
getCooldownsByKey
Get all cooldowns with the given key- Parameters:
key- the key of the cooldowns- Returns:
- all cooldowns with the given key
-
getCooldown
@NotNull public @NotNull Optional<AnnoyingCooldown> getCooldown(@NotNull @NotNull Object key, @NotNull @NotNull Object type) Get a cooldown with the given key and type- Parameters:
key- the key of the cooldowntype- the type of the cooldown- Returns:
- the cooldown with the given key and type
-
getCooldownElseNew
@NotNull public @NotNull AnnoyingCooldown getCooldownElseNew(@NotNull @NotNull Object key, @NotNull @NotNull Object type) Get a cooldown with the given key and type
If the cooldown doesn't exist yet, it will create a new one with the given key and type (it won't start it though)- Parameters:
key- the key of the cooldowntype- the type of the cooldown- Returns:
- the cooldown with the given key and type or the newly created cooldown
-