Merge pull request #4236 from kn-km/patch-2

Fix McMMOPlayerRepairCheckEvent Handling
This commit is contained in:
Robert Alan Chapton 2020-07-31 20:43:01 -07:00 committed by GitHub
commit 0dba450b5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,6 +128,9 @@ public class RepairManager extends SkillManager {
int baseRepairAmount = repairable.getBaseRepairDurability(item); // Did they send me daughters?
short newDurability = repairCalculate(startDurability, baseRepairAmount); // When I asked for sons?
// toRemove should be refreshed before the event call.
toRemove = inventory.getItem(inventory.first(repairMaterial)).clone();
// Call event
if (EventUtils.callRepairCheckEvent(player, (short) (startDurability - newDurability), toRemove, item).isCancelled()) {
return;
@ -139,7 +142,6 @@ public class RepairManager extends SkillManager {
}
// Remove the item
toRemove = inventory.getItem(inventory.first(repairMaterial)).clone();
toRemove.setAmount(1);
inventory.removeItem(toRemove);