summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2016-07-08 12:51:29 +1000
committermd_5 <git@md-5.net>2016-07-08 12:51:29 +1000
commita1760b6baec0db18f0eeda14e371a75fa6fc3d3b (patch)
tree65b00048f47e722771b80206647009816cb9a136 /src/main
parentc87a3104aed9d252da92241c0a5b5eef19ffe038 (diff)
downloadbukkit-a1760b6baec0db18f0eeda14e371a75fa6fc3d3b.tar
bukkit-a1760b6baec0db18f0eeda14e371a75fa6fc3d3b.tar.gz
bukkit-a1760b6baec0db18f0eeda14e371a75fa6fc3d3b.tar.lz
bukkit-a1760b6baec0db18f0eeda14e371a75fa6fc3d3b.tar.xz
bukkit-a1760b6baec0db18f0eeda14e371a75fa6fc3d3b.zip
SPIGOT-2481: Implement EnchantmentTarget.BREAKABLE
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/bukkit/enchantments/EnchantmentTarget.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
index d9b98ed6..dee2350d 100644
--- a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
+++ b/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;
+ }
};
/**