From 0c42c407cfd8231b658fd0c0f3a9495c43c652a5 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Fri, 8 Jul 2016 12:51:29 +1000 Subject: [PATCH] SPIGOT-2481: Implement EnchantmentTarget.BREAKABLE By: md_5 --- .../org/bukkit/enchantments/EnchantmentTarget.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java b/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java index d9b98ed6b4..dee2350d2b 100644 --- a/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java +++ b/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java @@ -150,6 +150,16 @@ public enum EnchantmentTarget { public boolean includes(Material item) { return item.equals(Material.FISHING_ROD); } + }, + + /** + * Allows the enchantment to be placed on items with durability. + */ + BREAKABLE { + @Override + public boolean includes(Material item) { + return item.getMaxDurability() > 0 && item.getMaxStackSize() == 1; + } }; /**