From dd170ec7ef6f1e82484e3d9408cf2008c1ece6c0 Mon Sep 17 00:00:00 2001 From: GJ Date: Mon, 26 Mar 2012 23:58:48 -0400 Subject: [PATCH] Fixed issue with repair event not returning the proper repair amount. --- Changelog.txt | 2 ++ src/main/java/com/gmail/nossr50/skills/Repair.java | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 5e360bd24..74bc016e7 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -8,10 +8,12 @@ Key: - Removal Version 1.3.04-dev + + Added McMMOPlayerRepairEvent for API usage - fires after completion of a repair. = Fixed Shake ability dropping bonemeal instead of ink for squids. = Fixed Green Terra & Super Breaker awarding 4x drops at high levels. = Fixed summoned ocelots never changing skins. ! Changed MySQL to reload all player information on reconnection + ! Move "fake" events to their own package - be sure to update these if you're using the API in your plugin Version 1.3.03 + Added Ocelots to Taming XP tables diff --git a/src/main/java/com/gmail/nossr50/skills/Repair.java b/src/main/java/com/gmail/nossr50/skills/Repair.java index bebb2a1f7..4f81bcafe 100644 --- a/src/main/java/com/gmail/nossr50/skills/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/Repair.java @@ -433,16 +433,16 @@ public class Repair { * @param enchantsLevel The level of the enchantments on the item */ public static void repairItem(Player player, ItemStack is) { + short initialDurability = is.getDurability(); /* Handle the enchants */ if (LoadProperties.mayLoseEnchants && !mcPermissions.getInstance().arcaneBypass(player)) { addEnchants(player, is); } - short repairAmount = getRepairAmount(is, player); - is.setDurability(repairAmount); + is.setDurability(getRepairAmount(is, player)); - McMMOPlayerRepairEvent event = new McMMOPlayerRepairEvent(player, is, repairAmount); + McMMOPlayerRepairEvent event = new McMMOPlayerRepairEvent(player, is, (short) (initialDurability - is.getDurability())); Bukkit.getPluginManager().callEvent(event); }