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 Details

    • cooldowns

      @NotNull public final @NotNull Set<AnnoyingCooldown> cooldowns
      A set of all cooldowns
  • Constructor Details

    • CooldownManager

      public CooldownManager()
      Constructs a new cooldown manager
  • Method Details

    • getCooldownsByType

      @NotNull public @NotNull Set<AnnoyingCooldown> getCooldownsByType(@NotNull @NotNull 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 Set<AnnoyingCooldown> getCooldownsByKey(@NotNull @NotNull 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 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 cooldown
      type - 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 cooldown
      type - the type of the cooldown
      Returns:
      the cooldown with the given key and type or the newly created cooldown