From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 5 Jun 2018 23:00:29 -0400 Subject: [PATCH] ItemStack#getMaxItemUseDuration Allows you to determine how long it takes to use a usable/consumable item diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index f42f6f5fb7a2398c183eb9fa1a964a7680b687b8..4fa1085532e9374aad3c877ca6aba1b251640cc8 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -184,6 +184,13 @@ public final class CraftItemStack extends ItemStack { return (this.handle == null) ? Material.AIR.getMaxStackSize() : this.handle.getItem().getMaxStackSize(); } + // Paper start + @Override + public int getMaxItemUseDuration() { + return handle == null ? 0 : handle.getUseDuration(); + } + // Paper end + @Override public void addUnsafeEnchantment(Enchantment ench, int level) { Preconditions.checkArgument(ench != null, "Enchantment cannot be null");