diff --git a/src/main/java/org/spongepowered/api/entity/living/player/CooldownTracker.java b/src/main/java/org/spongepowered/api/entity/living/player/CooldownTracker.java index 9a0c181506..2cc55b36fe 100644 --- a/src/main/java/org/spongepowered/api/entity/living/player/CooldownTracker.java +++ b/src/main/java/org/spongepowered/api/entity/living/player/CooldownTracker.java @@ -24,7 +24,9 @@ */ package org.spongepowered.api.entity.living.player; +import org.spongepowered.api.ResourceKey; import org.spongepowered.api.item.ItemType; +import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.util.Ticks; import java.util.Optional; @@ -42,7 +44,8 @@ public interface CooldownTracker { * @param type The item type to check is on cooldown * @return Whether or not the specified item type is cooldown */ - boolean hasCooldown(ItemType type); + boolean hasCooldown(ItemStack stack); + boolean hasCooldown(ResourceKey group); /** * Gets the cooldown of the specified {@link ItemType} in ticks for the @@ -52,7 +55,8 @@ public interface CooldownTracker { * @return The cooldown remaining for this item type in ticks, if not * on cooldown */ - Optional cooldown(ItemType type); + Optional cooldown(ItemStack stack); + Optional cooldown(ResourceKey group); /** * Sets the cooldown for the specified {@link ItemType} for the @@ -63,7 +67,8 @@ public interface CooldownTracker { * @return False if setting the cooldown failed, possibly due to the event * being cancelled */ - boolean setCooldown(ItemType type, Ticks ticks); + boolean setCooldown(ItemStack stack, Ticks ticks); + boolean setCooldown(ResourceKey group, Ticks ticks); /** * Resets the cooldown of the specified {@link ItemType} for the @@ -73,7 +78,8 @@ public interface CooldownTracker { * @return False if setting the cooldown failed, possibly due to the event * being cancelled */ - boolean resetCooldown(ItemType type); + boolean resetCooldown(ItemStack stack); + boolean resetCooldown(ResourceKey group); /** * Gets the fraction of the specified {@link ItemType}'s cooldown that @@ -85,6 +91,7 @@ public interface CooldownTracker { * @param type The item type to get the cooldown fraction remaining * @return The fraction of cooldown remaining for the specified item type */ - OptionalDouble fractionRemaining(ItemType type); + OptionalDouble fractionRemaining(ItemStack stack); + OptionalDouble fractionRemaining(ResourceKey group); } diff --git a/src/main/java/org/spongepowered/api/event/entity/living/player/CooldownEvent.java b/src/main/java/org/spongepowered/api/event/entity/living/player/CooldownEvent.java index 65555c1227..2fdb6f8f99 100644 --- a/src/main/java/org/spongepowered/api/event/entity/living/player/CooldownEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/living/player/CooldownEvent.java @@ -24,6 +24,7 @@ */ package org.spongepowered.api.event.entity.living.player; +import org.spongepowered.api.ResourceKey; import org.spongepowered.api.entity.living.player.CooldownTracker; import org.spongepowered.api.entity.living.player.server.ServerPlayer; import org.spongepowered.api.event.Cancellable; @@ -47,11 +48,11 @@ public interface CooldownEvent extends Event { ServerPlayer player(); /** - * Gets the associated item type whose cooldown is being set or removed. + * Gets the associated item group whose cooldown is being set or removed. * * @return The associated item type */ - ItemType itemType(); + ResourceKey group(); /** * Handles an {@link ItemType} being given a cooldown for a {@link ServerPlayer player}.