summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2017-04-19 17:41:34 +1000
committermd_5 <git@md-5.net>2017-04-19 18:03:16 +1000
commit817fefd8466bf993e6629e686a72c94c51fedf90 (patch)
treed282974729fa741c3cb1b468d09961fcddcad98c /src/main
parent6751fefdda0b171e0830d31e701d4be66af73c9d (diff)
downloadbukkit-817fefd8466bf993e6629e686a72c94c51fedf90.tar
bukkit-817fefd8466bf993e6629e686a72c94c51fedf90.tar.gz
bukkit-817fefd8466bf993e6629e686a72c94c51fedf90.tar.lz
bukkit-817fefd8466bf993e6629e686a72c94c51fedf90.tar.xz
bukkit-817fefd8466bf993e6629e686a72c94c51fedf90.zip
Add API for manipulating item cooldowns.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/bukkit/entity/HumanEntity.java32
1 files changed, 32 insertions, 0 deletions
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;
@@ -175,6 +176,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.
+ * <p>
+ * Cooldowns are used by the server for items such as ender pearls and
+ * shields to prevent them from being used repeatedly.
+ * <p>
+ * 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.
*
* @return slumber state