mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Fixed Durability Enchantment on damageable Items
This commit is contained in:
parent
dd14816504
commit
6473988df4
@ -13,7 +13,11 @@ public interface DamageableItem {
|
||||
boolean isDamageable();
|
||||
|
||||
default void damageItem(Player p, ItemStack item) {
|
||||
if (item != null && item.getType() != null && item.getType() != Material.AIR && item.getAmount() > 0 && isDamageable() && item.getEnchantments().containsKey(Enchantment.DURABILITY) && Math.random() * 100 <= (60 + Math.floorDiv(40, (item.getEnchantmentLevel(Enchantment.DURABILITY) + 1)))) {
|
||||
if (item != null && item.getType() != null && item.getType() != Material.AIR && item.getAmount() > 0 && isDamageable()) {
|
||||
if (item.getEnchantments().containsKey(Enchantment.DURABILITY) && Math.random() * 100 <= (60 + Math.floorDiv(40, (item.getEnchantmentLevel(Enchantment.DURABILITY) + 1)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
Damageable damageable = (Damageable) meta;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user