From 817fefd8466bf993e6629e686a72c94c51fedf90 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 19 Apr 2017 17:41:34 +1000 Subject: Add API for manipulating item cooldowns. --- src/main/java/org/bukkit/entity/HumanEntity.java | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/main') diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java index ede84ef9..4b540fe8 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java @@ -2,6 +2,7 @@ package org.bukkit.entity; import org.bukkit.GameMode; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.inventory.MainHand; import org.bukkit.inventory.Merchant; import org.bukkit.inventory.Inventory; @@ -174,6 +175,37 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible, Inv */ public void setItemOnCursor(ItemStack item); + /** + * Check whether a cooldown is active on the specified material. + * + * @param material the material to check + * @return if a cooldown is active on the material + */ + public boolean hasCooldown(Material material); + + /** + * Get the cooldown time in ticks remaining for the specified material. + * + * @param material the material to check + * @return the remaining cooldown time in ticks + */ + public int getCooldown(Material material); + + /** + * Set a cooldown on the specified material for a certain amount of ticks. + * ticks. 0 ticks will result in the removal of the cooldown. + *

+ * Cooldowns are used by the server for items such as ender pearls and + * shields to prevent them from being used repeatedly. + *

+ * Note that cooldowns will not by themselves stop an item from being used + * for attacking. + * + * @param material the material to set the cooldown for + * @param ticks the amount of ticks to set or 0 to remove + */ + public void setCooldown(Material material, int ticks); + /** * Returns whether this player is slumbering. * -- cgit v1.2.3