Interface CooldownTracker
public interface CooldownTracker
Provides access to the item cooldowns of a
Player
.-
Method Summary
Modifier and TypeMethodDescriptionGets the cooldown of the specifiedItemType
in ticks for the player, or empty if the the item type is currently not on cooldown.cooldown
(ResourceKey group) Gets the cooldown for the specifiedgroup
in ticks for the player, or empty if the group is not on cooldown.fractionRemaining
(ItemStack stack) Gets the fraction of the specifiedItemType
's cooldown that is remaining for the player, or empty if the the item type is currently not on cooldown.fractionRemaining
(ResourceKey group) boolean
hasCooldown
(ItemStack stack) Checks if the specifiedItemType
is currently on cooldown for the player.boolean
hasCooldown
(ResourceKey group) boolean
resetCooldown
(ItemStack stack) Resets the cooldown of the specifiedItemType
for the player.boolean
resetCooldown
(ResourceKey group) boolean
setCooldown
(ItemStack stack, Ticks ticks) Sets the cooldown for the specifiedItemType
for the specified amount of ticks.boolean
setCooldown
(ResourceKey group, Ticks ticks)
-
Method Details
-
hasCooldown
Checks if the specifiedItemType
is currently on cooldown for the player.- Parameters:
stack
- The item type to check is on cooldown- Returns:
- Whether or not the specified item type is cooldown
-
hasCooldown
-
cooldown
Gets the cooldown of the specifiedItemType
in ticks for the player, or empty if the the item type is currently not on cooldown.- Parameters:
stack
- The item type to get the cooldown for- Returns:
- The cooldown remaining for this item type in ticks, if not on cooldown
-
cooldown
Gets the cooldown for the specifiedgroup
in ticks for the player, or empty if the group is not on cooldown.- Parameters:
group
- The group to get the cooldown for- Returns:
- The cooldown remaining for this group in ticks, if not on cooldown
-
setCooldown
Sets the cooldown for the specifiedItemType
for the specified amount of ticks.- Parameters:
stack
- The item type to set the cooldown forticks
- The amount of ticks to set the item type on cooldown for- Returns:
- False if setting the cooldown failed, possibly due to the event being cancelled
-
setCooldown
-
resetCooldown
Resets the cooldown of the specifiedItemType
for the player.- Parameters:
stack
- The item type to reset the cooldown for- Returns:
- False if setting the cooldown failed, possibly due to the event being cancelled
-
resetCooldown
-
fractionRemaining
Gets the fraction of the specifiedItemType
's cooldown that is remaining for the player, or empty if the the item type is currently not on cooldown.If present, this value will be between 0.0 and 1.0.
- Parameters:
stack
- The item type to get the cooldown fraction remaining- Returns:
- The fraction of cooldown remaining for the specified item type
-
fractionRemaining
-