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.StringableThis class is used to manage all cooldowns- See Also:
AnnoyingPlugin.cooldownManager,AnnoyingCooldown
-
-
Field Summary
Fields Modifier and Type Field Description @NotNull java.util.Set<AnnoyingCooldown>cooldownsA set of all cooldowns
-
Constructor Summary
Constructors Constructor Description CooldownManager()Constructs a new cooldown manager
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull java.util.Optional<AnnoyingCooldown>getCooldown(@NotNull java.lang.Object key, @NotNull java.lang.Object type)Get a cooldown with the given key and type@NotNull AnnoyingCooldowngetCooldownElseNew(@NotNull java.lang.Object key, @NotNull java.lang.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 java.util.Set<AnnoyingCooldown>getCooldownsByKey(@NotNull java.lang.Object key)Get all cooldowns with the given key@NotNull java.util.Set<AnnoyingCooldown>getCooldownsByType(@NotNull java.lang.Object type)Get all cooldowns with the given type
-
-
-
Field Detail
-
cooldowns
@NotNull public final @NotNull java.util.Set<AnnoyingCooldown> cooldowns
A set of all cooldowns
-
-
Method Detail
-
getCooldownsByType
@NotNull public @NotNull java.util.Set<AnnoyingCooldown> getCooldownsByType(@NotNull @NotNull java.lang.Object type)
Get all cooldowns with the given type- Parameters:
type- the type of the cooldowns- Returns:
- all cooldowns with the given type
-
getCooldownsByKey
@NotNull public @NotNull java.util.Set<AnnoyingCooldown> getCooldownsByKey(@NotNull @NotNull java.lang.Object key)
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 java.util.Optional<AnnoyingCooldown> getCooldown(@NotNull @NotNull java.lang.Object key, @NotNull @NotNull java.lang.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 java.lang.Object key, @NotNull @NotNull java.lang.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
-
-