diff --git a/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java b/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java index e66a958bc3..a3de566c8f 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java @@ -670,5 +670,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public String getI18NDisplayName() { return Bukkit.getServer().getItemFactory().getI18NDisplayName(this); } + + /** + * @deprecated use {@link #getMaxItemUseDuration(org.bukkit.entity.LivingEntity)}; crossbows, later possibly more items require an entity parameter + */ + @Deprecated(forRemoval = true) + public int getMaxItemUseDuration() { + return getMaxItemUseDuration(null); + } + + public int getMaxItemUseDuration(@NotNull final org.bukkit.entity.LivingEntity entity) { + if (type == null || type == Material.AIR || !type.isItem()) { + return 0; + } + // Requires access to NMS + return ensureServerConversions().getMaxItemUseDuration(entity); + } // Paper end }