Fixed issue with repair event not returning the proper repair amount.

This commit is contained in:
GJ 2012-03-26 23:58:48 -04:00
parent 2d3b01ba34
commit dd170ec7ef
2 changed files with 5 additions and 3 deletions

View File

@ -8,10 +8,12 @@ Key:
- Removal - Removal
Version 1.3.04-dev 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 Shake ability dropping bonemeal instead of ink for squids.
= Fixed Green Terra & Super Breaker awarding 4x drops at high levels. = Fixed Green Terra & Super Breaker awarding 4x drops at high levels.
= Fixed summoned ocelots never changing skins. = Fixed summoned ocelots never changing skins.
! Changed MySQL to reload all player information on reconnection ! 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 Version 1.3.03
+ Added Ocelots to Taming XP tables + Added Ocelots to Taming XP tables

View File

@ -433,16 +433,16 @@ public class Repair {
* @param enchantsLevel The level of the enchantments on the item * @param enchantsLevel The level of the enchantments on the item
*/ */
public static void repairItem(Player player, ItemStack is) { public static void repairItem(Player player, ItemStack is) {
short initialDurability = is.getDurability();
/* Handle the enchants */ /* Handle the enchants */
if (LoadProperties.mayLoseEnchants && !mcPermissions.getInstance().arcaneBypass(player)) { if (LoadProperties.mayLoseEnchants && !mcPermissions.getInstance().arcaneBypass(player)) {
addEnchants(player, is); addEnchants(player, is);
} }
short repairAmount = getRepairAmount(is, player); is.setDurability(getRepairAmount(is, player));
is.setDurability(repairAmount);
McMMOPlayerRepairEvent event = new McMMOPlayerRepairEvent(player, is, repairAmount); McMMOPlayerRepairEvent event = new McMMOPlayerRepairEvent(player, is, (short) (initialDurability - is.getDurability()));
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
} }