1
0
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:
Zrips 2021-09-13 15:09:43 +03:00
parent 8e61bf2d28
commit c7db265f9e
2 changed files with 11 additions and 17 deletions

View File

@ -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)

View File

@ -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);
}
}
}