SPIGOT-2481: Implement EnchantmentTarget.BREAKABLE

This commit is contained in:
md_5 2016-07-08 12:51:32 +10:00
parent e3b4dd3d9a
commit 9c02c12179
2 changed files with 12 additions and 0 deletions

View File

@ -47,6 +47,8 @@ public class CraftEnchantment extends Enchantment {
return EnchantmentTarget.BOW;
case FISHING_ROD:
return EnchantmentTarget.FISHING_ROD;
case BREAKABLE:
return EnchantmentTarget.BREAKABLE;
default:
return null;
}

View File

@ -27,6 +27,7 @@ import java.util.Map;
import net.minecraft.server.Block;
import net.minecraft.server.Blocks;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.enchantments.EnchantmentTarget;
@RunWith(Parameterized.class)
public class PerMaterialTest extends AbstractTestingBase {
@ -146,4 +147,13 @@ public class PerMaterialTest extends AbstractTestingBase {
assertFalse(material.hasGravity());
}
}
@Test
public void usesDurability() {
if (!material.isBlock()) {
assertThat(EnchantmentTarget.BREAKABLE.includes(material), is(CraftMagicNumbers.getItem(material).usesDurability()));
} else {
assertFalse(EnchantmentTarget.BREAKABLE.includes(material));
}
}
}