Forgot to call mend event before checking its state

This commit is contained in:
Hernán Indíbil de la Cruz Calvo 2024-08-31 13:18:38 +02:00 committed by GitHub
parent beea47cee2
commit 8a3e6b74ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -260,6 +260,7 @@ public final class SkillUtils {
ExperienceOrb auxOrb = (ExperienceOrb) player.getWorld().spawnEntity(player.getLocation(), EntityType.EXPERIENCE_ORB); ExperienceOrb auxOrb = (ExperienceOrb) player.getWorld().spawnEntity(player.getLocation(), EntityType.EXPERIENCE_ORB);
auxOrb.setExperience(damage / 2); auxOrb.setExperience(damage / 2);
PlayerItemMendEvent event = new PlayerItemMendEvent(player, itemStack, itemStack.getType().getEquipmentSlot(), auxOrb, damage); PlayerItemMendEvent event = new PlayerItemMendEvent(player, itemStack, itemStack.getType().getEquipmentSlot(), auxOrb, damage);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getRepairAmount() != 0) { if (!event.isCancelled() && event.getRepairAmount() != 0) {
itemStack.setDurability((short) (itemStack.getDurability() - event.getRepairAmount())); itemStack.setDurability((short) (itemStack.getDurability() - event.getRepairAmount()));
} }