Package dev.sefiraat.sefilib.itemstacks
Class Cooldowns
java.lang.Object
dev.sefiraat.sefilib.itemstacks.Cooldowns
This class contains a bunch of static methods that can be used to put and check
ItemStacks cooldowns.-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddCooldown(NamespacedKey key, ItemStack itemStack, int durationInSeconds) Adds a time to the providedItemStackthat can be checked to see if the item is on cooldown.static voidaddCooldown(NamespacedKey key, ItemStack itemStack, long durationInMs) Adds a time to the providedItemStackthat can be checked to see if the item is on cooldown.static voidaddCooldown(NamespacedKey key, PersistentDataHolder holder, int durationInSeconds) Adds a time to the providedItemStackthat can be checked to see if the item is on cooldown.static voidaddCooldown(NamespacedKey key, PersistentDataHolder holder, long durationInMs) Adds a time to the providedItemStackthat can be checked to see if the item is on cooldown.static booleanisOnCooldown(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 cooldownstatic booleanisOnCooldown(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
-
Method Details
-
addCooldown
@ParametersAreNonnullByDefault public static void addCooldown(NamespacedKey key, ItemStack itemStack, int durationInSeconds) Adds a time to the providedItemStackthat can be checked to see if the item is on cooldown.- Parameters:
key- ANamespacedKeyfor this cooldownitemStack- TheItemStackto put on cooldowndurationInSeconds- 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 providedItemStackthat can be checked to see if the item is on cooldown.- Parameters:
key- ANamespacedKeyfor this cooldownitemStack- TheItemStackto put on cooldowndurationInMs- 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 providedItemStackthat can be checked to see if the item is on cooldown.- Parameters:
key- ANamespacedKeyfor this cooldownholder- ThePersistentDataHolderto put on cooldowndurationInSeconds- 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 providedItemStackthat can be checked to see if the item is on cooldown.- Parameters:
key- ANamespacedKeyfor this cooldownholder- ThePersistentDataHolderto put on cooldowndurationInMs- 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- ANamespacedKeymatching the cooldown to retrieveitemStack- TheItemStackto 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- ANamespacedKeymatching the cooldown to retrieveholder- ThePersistentDataHolderto put on cooldown- Returns:
- True if the item is still on cooldown. False if expired or has no cooldown
-