Commits

md_5 authored a1760b6baec
SPIGOT-2481: Implement EnchantmentTarget.BREAKABLE
No tags

src/main/java/org/bukkit/enchantments/EnchantmentTarget.java

Modified
143 143 },
144 144
145 145 /**
146 146 * Allows the Enchantment to be placed on fishing rods.
147 147 */
148 148 FISHING_ROD {
149 149 @Override
150 150 public boolean includes(Material item) {
151 151 return item.equals(Material.FISHING_ROD);
152 152 }
153 + },
154 +
155 + /**
156 + * Allows the enchantment to be placed on items with durability.
157 + */
158 + BREAKABLE {
159 + @Override
160 + public boolean includes(Material item) {
161 + return item.getMaxDurability() > 0 && item.getMaxStackSize() == 1;
162 + }
153 163 };
154 164
155 165 /**
156 166 * Check whether this target includes the specified item.
157 167 *
158 168 * @param item The item to check
159 169 * @return True if the target includes the item
160 170 */
161 171 public abstract boolean includes(Material item);
162 172

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut