Class Cooldowns

java.lang.Object
dev.sefiraat.sefilib.itemstacks.Cooldowns

public final class Cooldowns extends Object
This class contains a bunch of static methods that can be used to put and check ItemStacks cooldowns.
  • Method Details

    • addCooldown

      @ParametersAreNonnullByDefault public static void addCooldown(NamespacedKey key, ItemStack itemStack, int durationInSeconds)
      Adds a time to the provided ItemStack that can be checked to see if the item is on cooldown.
      Parameters:
      key - A NamespacedKey for this cooldown
      itemStack - The ItemStack to put on cooldown
      durationInSeconds - The duration in seconds to put the stack on cooldown for
      See Also:
    • addCooldown

      @ParametersAreNonnullByDefault public static void addCooldown(NamespacedKey key, ItemStack itemStack, long durationInMs)
      Adds a time to the provided ItemStack that can be checked to see if the item is on cooldown.
      Parameters:
      key - A NamespacedKey for this cooldown
      itemStack - The ItemStack to put on cooldown
      durationInMs - The duration in milliseconds to put the stack on cooldown for
      See Also:
    • addCooldown

      @ParametersAreNonnullByDefault public static void addCooldown(NamespacedKey key, PersistentDataHolder holder, int durationInSeconds)
      Adds a time to the provided ItemStack that can be checked to see if the item is on cooldown.
      Parameters:
      key - A NamespacedKey for this cooldown
      holder - The PersistentDataHolder to put on cooldown
      durationInSeconds - The duration in seconds to put the stack on cooldown for
      See Also:
    • addCooldown

      @ParametersAreNonnullByDefault public static void addCooldown(NamespacedKey key, PersistentDataHolder holder, long durationInMs)
      Adds a time to the provided ItemStack that can be checked to see if the item is on cooldown.
      Parameters:
      key - A NamespacedKey for this cooldown
      holder - The PersistentDataHolder to put on cooldown
      durationInMs - The duration in milliseconds to put the stack on cooldown for
      See Also:
    • isOnCooldown

      @ParametersAreNonnullByDefault public static boolean isOnCooldown(NamespacedKey key, ItemStack itemStack)
      Checks if the item has a cooldown time and returns if it has not yet expired or false if it doesn't have a matching cooldown
      Parameters:
      key - A NamespacedKey matching the cooldown to retrieve
      itemStack - The ItemStack to put on cooldown
      Returns:
      True if the item is still on cooldown. False if expired or has no cooldown
    • isOnCooldown

      @ParametersAreNonnullByDefault public static boolean isOnCooldown(NamespacedKey key, PersistentDataHolder holder)
      Checks if the item has a cooldown time and returns if it has not yet expired or false if it doesn't have a matching cooldown
      Parameters:
      key - A NamespacedKey matching the cooldown to retrieve
      holder - The PersistentDataHolder to put on cooldown
      Returns:
      True if the item is still on cooldown. False if expired or has no cooldown