Merge branch 'master' of github.com:mcMMO-Dev/mcMMO

This commit is contained in:
nossr50 2020-07-31 20:47:01 -07:00
commit d1b7e88b7e
2 changed files with 6 additions and 3 deletions

View File

@ -128,6 +128,9 @@ public class RepairManager extends SkillManager {
int baseRepairAmount = repairable.getBaseRepairDurability(item); // Did they send me daughters? int baseRepairAmount = repairable.getBaseRepairDurability(item); // Did they send me daughters?
short newDurability = repairCalculate(startDurability, baseRepairAmount); // When I asked for sons? 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 // Call event
if (EventUtils.callRepairCheckEvent(player, (short) (startDurability - newDurability), toRemove, item).isCancelled()) { if (EventUtils.callRepairCheckEvent(player, (short) (startDurability - newDurability), toRemove, item).isCancelled()) {
return; return;
@ -139,7 +142,6 @@ public class RepairManager extends SkillManager {
} }
// Remove the item // Remove the item
toRemove = inventory.getItem(inventory.first(repairMaterial)).clone();
toRemove.setAmount(1); toRemove.setAmount(1);
inventory.removeItem(toRemove); inventory.removeItem(toRemove);
@ -393,4 +395,4 @@ public class RepairManager extends SkillManager {
public void actualizeLastAnvilUse() { public void actualizeLastAnvilUse() {
lastClick = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR); lastClick = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
} }
} }

View File

@ -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. 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); location.add(0.5, 1, 0.5);
Map<Enchantment, Integer> enchants = item.getEnchantments(); Map<Enchantment, Integer> enchants = item.getEnchantments();
@ -140,6 +139,8 @@ public class SalvageManager extends SkillManager {
return; return;
} }
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
Location anvilLoc = location.clone(); Location anvilLoc = location.clone();
Location playerLoc = player.getLocation().clone(); Location playerLoc = player.getLocation().clone();
double distance = anvilLoc.distance(playerLoc); double distance = anvilLoc.distance(playerLoc);