From 5d294d6dc3040baa00638e44c67d787513cd82d0 Mon Sep 17 00:00:00 2001 From: kn-km <974787396@qq.com> Date: Mon, 27 Jul 2020 22:55:44 +0800 Subject: [PATCH 1/2] Fix #4234 --- .../java/com/gmail/nossr50/skills/salvage/SalvageManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java index 7eab2c9dc..cb4374b5a 100644 --- a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java +++ b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java @@ -100,7 +100,6 @@ public class SalvageManager extends SkillManager { potentialSalvageYield = Math.min(potentialSalvageYield, getSalvageLimit()); // Always get at least something back, if you're capable of salvaging it. - player.getInventory().setItemInMainHand(new ItemStack(Material.AIR)); location.add(0.5, 1, 0.5); Map enchants = item.getEnchantments(); @@ -140,6 +139,8 @@ public class SalvageManager extends SkillManager { return; } + player.getInventory().setItemInMainHand(new ItemStack(Material.AIR)); + Location anvilLoc = location.clone(); Location playerLoc = player.getLocation().clone(); double distance = anvilLoc.distance(playerLoc); From ed9521d4a048dfb7b7dc169802cfbc0b9d8247be Mon Sep 17 00:00:00 2001 From: kn-km <974787396@qq.com> Date: Mon, 27 Jul 2020 23:18:55 +0800 Subject: [PATCH 2/2] Fix #4234 --- .../java/com/gmail/nossr50/skills/repair/RepairManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java index ab4a98fbe..910c3f5bf 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java @@ -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); @@ -393,4 +395,4 @@ public class RepairManager extends SkillManager { public void actualizeLastAnvilUse() { lastClick = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR); } -} \ No newline at end of file +}