Adds a new check for items with full durability (#4)

This commit is contained in:
2022-10-03 13:03:21 +02:00
parent 5897f68b42
commit 505d6bfb2b
7 changed files with 72 additions and 39 deletions

View File

@ -4,6 +4,7 @@ import net.citizensnpcs.api.npc.NPC;
import net.knarcraft.blacksmith.BlacksmithPlugin;
import net.knarcraft.blacksmith.config.NPCSettings;
import net.knarcraft.blacksmith.manager.EconomyManager;
import net.knarcraft.blacksmith.util.ItemHelper;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.LivingEntity;
@ -163,7 +164,7 @@ public class ReforgeSession implements Runnable {
}
// Damage the item
short currentItemDurability = EconomyManager.getDurability(itemToReforge);
short currentItemDurability = ItemHelper.getDurability(itemToReforge);
short newDurability = (short) (currentItemDurability + (currentItemDurability * random.nextInt(8)));
short maxDurability = itemToReforge.getType().getMaxDurability();
if (newDurability <= 0) {