From 560a2def41ddbef368911747d21af08ed4b7ac6e Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 4 Jun 2022 12:08:50 +0200 Subject: [PATCH] Fixed an issue with paper having durability, like wth spigot --- src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java b/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java index b15bb60a..64a5744a 100644 --- a/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java +++ b/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java @@ -196,7 +196,7 @@ public class MMOCoreUtils { */ public static void decreaseDurability(Player player, EquipmentSlot slot, int damage) { ItemStack item = player.getInventory().getItem(slot); - if (!item.hasItemMeta() || !(item.getItemMeta() instanceof Damageable) || item.getItemMeta().isUnbreakable()) + if (item == null || item.getType().getMaxDurability() == 0 || !item.hasItemMeta() || !(item.getItemMeta() instanceof Damageable) || item.getItemMeta().isUnbreakable()) return; PlayerItemDamageEvent event = new PlayerItemDamageEvent(player, item, damage);