From bdc753f03c9ff57565f9ba29b8d8d36d7f1c5888 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Thu, 25 Apr 2013 23:40:21 +0200 Subject: [PATCH] Also add the cancel feature for the Salvage Anvil --- .../com/gmail/nossr50/listeners/PlayerListener.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 22431dd65..c9bfc4300 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -365,6 +365,16 @@ public class PlayerListener implements Listener { player.sendMessage(ChatColor.RED + "Repair cancelled!"); //TODO Locale! } } + /* SALVAGE CHECKS */ + else if (blockID == Repair.salvageAnvilId && Permissions.salvage(player) && Repair.isSalvageable(heldItem)) { + RepairManager repairManager = UserManager.getPlayer(player).getRepairManager(); + + // Cancel salvaging an enchanted item + if (repairManager.checkConfirmation(blockID, false) && Config.getInstance().getRepairConfirmRequired()) { + UserManager.getPlayer(player).setLastAnvilUse(Repair.salvageAnvilId, 0); + player.sendMessage(ChatColor.RED + "Salvage cancelled!"); //TODO Locale! + } + } break;