mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 11:45: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();
|
boolean isDamageable();
|
||||||
|
|
||||||
default void damageItem(Player p, ItemStack item) {
|
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();
|
ItemMeta meta = item.getItemMeta();
|
||||||
Damageable damageable = (Damageable) meta;
|
Damageable damageable = (Damageable) meta;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user