mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 20:30:28 +01:00
SPIGOT-2481: Implement EnchantmentTarget.BREAKABLE
This commit is contained in:
parent
e3b4dd3d9a
commit
9c02c12179
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user