aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0195-ItemStack-getMaxItemUseDuration.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0195-ItemStack-getMaxItemUseDuration.patch')
-rw-r--r--patches/server/0195-ItemStack-getMaxItemUseDuration.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/patches/server/0195-ItemStack-getMaxItemUseDuration.patch b/patches/server/0195-ItemStack-getMaxItemUseDuration.patch
new file mode 100644
index 0000000000..d7b18de72a
--- /dev/null
+++ b/patches/server/0195-ItemStack-getMaxItemUseDuration.patch
@@ -0,0 +1,25 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Aikar <[email protected]>
+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 d302767e8f01fdfcba9c22e2e35677afc18c0641..45a1f5123e5413cf8dd3db68bb47508567198403 100644
+--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+@@ -187,6 +187,13 @@ public final class CraftItemStack extends ItemStack {
+ return (this.handle == null) ? Material.AIR.getMaxStackSize() : this.handle.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");