mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
Lets not remove block protection from old location on piston move
This commit is contained in:
parent
8e61bf2d28
commit
c7db265f9e
@ -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)
|
||||
|
@ -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<Block> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user