diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 212c9fa06f..1e973add11 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -473,14 +473,16 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @Override public boolean hasCooldown(Material material) { - Preconditions.checkArgument(material != null, "material"); + Preconditions.checkArgument(material != null, "Material cannot be null"); + Preconditions.checkArgument(material.isItem(), "Material %s is not an item", material); return getHandle().getCooldowns().isOnCooldown(CraftMagicNumbers.getItem(material)); } @Override public int getCooldown(Material material) { - Preconditions.checkArgument(material != null, "material"); + Preconditions.checkArgument(material != null, "Material cannot be null"); + Preconditions.checkArgument(material.isItem(), "Material %s is not an item", material); ItemCooldown.Info cooldown = getHandle().getCooldowns().cooldowns.get(CraftMagicNumbers.getItem(material)); return (cooldown == null) ? 0 : Math.max(0, cooldown.endTime - getHandle().getCooldowns().tickCount); @@ -488,7 +490,8 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @Override public void setCooldown(Material material, int ticks) { - Preconditions.checkArgument(material != null, "material"); + Preconditions.checkArgument(material != null, "Material cannot be null"); + Preconditions.checkArgument(material.isItem(), "Material %s is not an item", material); Preconditions.checkArgument(ticks >= 0, "Cannot have negative cooldown"); getHandle().getCooldowns().addCooldown(CraftMagicNumbers.getItem(material), ticks);