testserver/patches/server/0205-ItemStack-getMaxItemUs...

26 lines
1.1 KiB
Diff
Raw Normal View History

2021-06-12 19:30:37 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 379612cb78d275fa61125390c7429fcb2920ab33..efdcccac85626835ff29ed00976978d5bb900356 100644
2021-06-12 19:30:37 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
2021-06-15 22:24:12 +00:00
@@ -172,6 +172,13 @@ public final class CraftItemStack extends ItemStack {
2021-06-12 19:30:37 +00:00
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) {
Validate.notNull(ench, "Cannot add null enchantment");