From 0a9e1ba42e294388e10d2900822e035065f16d9f Mon Sep 17 00:00:00 2001 From: GJ Date: Wed, 23 Jan 2013 17:52:59 -0500 Subject: [PATCH] Start cleaning up BlockListener. --- .../nossr50/listeners/BlockListener.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 2ba53d6d1..98ad0a1a7 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -101,25 +101,31 @@ public class BlockListener implements Listener { */ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockPlace(BlockPlaceEvent event) { - Config configInstance = Config.getInstance(); + Player player = event.getPlayer(); + + if (Misc.isNPC(player)) { + return; + } Block block = event.getBlock(); - Player player = event.getPlayer(); - int id = block.getTypeId(); - - if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC /* Check if the blocks placed should be monitored so they do not give out XP in the future */ if (BlockChecks.shouldBeWatched(block)) { mcMMO.placeStore.setTrue(block); } - if (id == configInstance.getRepairAnvilId() && configInstance.getRepairAnvilMessagesEnabled()) { - Repair.placedAnvilCheck(player, id); - } - if (id == configInstance.getSalvageAnvilId() && configInstance.getRepairAnvilMessagesEnabled()) { - Salvage.placedAnvilCheck(player, id); + if (Config.getInstance().getRepairAnvilMessagesEnabled()) { + int id = block.getTypeId(); + + if (id == Config.getInstance().getRepairAnvilId()) { + Repair.placedAnvilCheck(player, id); + } + else if (id == Config.getInstance().getSalvageAnvilId()) { + Salvage.placedAnvilCheck(player, id); + } } + + } /**