mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-07 03:10:50 +01:00
26 lines
1.2 KiB
Diff
26 lines
1.2 KiB
Diff
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 ee5989e52ce0b55d8bf867ab10801ba3252c88a5..550d3290c974eebdeb4bf9b90987448c5d3d2999 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");
|