Interface CooldownTracker
-
public interface CooldownTrackerProvides access to the item cooldowns of aPlayer.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<Ticks>cooldown(ItemType type)Gets the cooldown of the specifiedItemTypein ticks for the player, or empty if the the item type is currently not on cooldown.OptionalDoublefractionRemaining(ItemType type)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.booleanhasCooldown(ItemType type)Checks if the specifiedItemTypeis currently on cooldown for the player.booleanresetCooldown(ItemType type)Resets the cooldown of the specifiedItemTypefor the player.booleansetCooldown(ItemType type, Ticks ticks)Sets the cooldown for the specifiedItemTypefor the specified amount of ticks.
-
-
-
Method Detail
-
hasCooldown
boolean hasCooldown(ItemType type)
Checks if the specifiedItemTypeis currently on cooldown for the player.- Parameters:
type- The item type to check is on cooldown- Returns:
- Whether or not the specified item type is cooldown
-
cooldown
Optional<Ticks> cooldown(ItemType type)
Gets the cooldown of the specifiedItemTypein ticks for the player, or empty if the the item type is currently not on cooldown.- Parameters:
type- The item type to get the cooldown for- Returns:
- The cooldown remaining for this item type in ticks, if not on cooldown
-
setCooldown
boolean setCooldown(ItemType type, Ticks ticks)
Sets the cooldown for the specifiedItemTypefor the specified amount of ticks.- Parameters:
type- 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
-
resetCooldown
boolean resetCooldown(ItemType type)
Resets the cooldown of the specifiedItemTypefor the player.- Parameters:
type- The item type to reset the cooldown for- Returns:
- False if setting the cooldown failed, possibly due to the event being cancelled
-
fractionRemaining
OptionalDouble fractionRemaining(ItemType type)
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:
type- The item type to get the cooldown fraction remaining- Returns:
- The fraction of cooldown remaining for the specified item type
-
-