diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index e9fc165d..0b1a7c3d 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -224,7 +224,7 @@ public final class JobsPaymentListener implements Listener { ItemStack toCraft = event.getCurrentItem(); ItemStack toStore = event.getCursor(); // Make sure we are actually traded anything - if (hasItems(toCraft)) + if (hasItems(toCraft)) { if (event.isShiftClick()) schedulePostDetection(player, toCraft.clone(), jPlayer, resultStack.clone(), ActionType.VTRADE); else { @@ -241,6 +241,7 @@ public final class JobsPaymentListener implements Listener { } } } + } } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) diff --git a/src/main/java/com/gamingmesh/jobs/listeners/PistonProtectionListener.java b/src/main/java/com/gamingmesh/jobs/listeners/PistonProtectionListener.java index 9e32b171..8c433974 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/PistonProtectionListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/PistonProtectionListener.java @@ -22,18 +22,15 @@ public class PistonProtectionListener implements Listener { return; BlockFace dir = event.getDirection(); - int x = dir.getModX(), - y = dir.getModY(), - z = dir.getModZ(); for (int i = event.getBlocks().size() - 1; i >= 0; i--) { Location oldLoc = event.getBlocks().get(i).getLocation(); - Location newLoc = oldLoc.clone().add(x, y, z); + Location newLoc = oldLoc.clone().add(dir.getModX(), dir.getModY(), dir.getModZ()); Long bp = Jobs.getBpManager().getTime(oldLoc); - if (bp != null) { - Jobs.getBpManager().addP(newLoc, bp, false, true); - Jobs.getBpManager().remove(oldLoc); - } + + if (bp == null) + continue; + Jobs.getBpManager().addP(newLoc, bp, false, true); } } @@ -43,19 +40,15 @@ public class PistonProtectionListener implements Listener { return; BlockFace dir = event.getDirection(); - int x = dir.getModX(), - y = dir.getModY(), - z = dir.getModZ(); List blocks = Util.getPistonRetractBlocks(event); for (int i = blocks.size() - 1; i >= 0; i--) { Location oldLoc = blocks.get(i).getLocation(); - Location newLoc = oldLoc.clone().add(x, y, z); + Location newLoc = oldLoc.clone().add(dir.getModX(), dir.getModY(), dir.getModZ()); Long bp = Jobs.getBpManager().getTime(oldLoc); - if (bp != null) { - Jobs.getBpManager().addP(newLoc, bp, false, true); - Jobs.getBpManager().remove(oldLoc); - } + if (bp == null) + continue; + Jobs.getBpManager().addP(newLoc, bp, false, true); } } }