mirror of
https://github.com/Zrips/Jobs.git
synced 2025-02-27 09:43:22 +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 toCraft = event.getCurrentItem();
|
||||||
ItemStack toStore = event.getCursor();
|
ItemStack toStore = event.getCursor();
|
||||||
// Make sure we are actually traded anything
|
// Make sure we are actually traded anything
|
||||||
if (hasItems(toCraft))
|
if (hasItems(toCraft)) {
|
||||||
if (event.isShiftClick())
|
if (event.isShiftClick())
|
||||||
schedulePostDetection(player, toCraft.clone(), jPlayer, resultStack.clone(), ActionType.VTRADE);
|
schedulePostDetection(player, toCraft.clone(), jPlayer, resultStack.clone(), ActionType.VTRADE);
|
||||||
else {
|
else {
|
||||||
@ -241,6 +241,7 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
@ -22,18 +22,15 @@ public class PistonProtectionListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
BlockFace dir = event.getDirection();
|
BlockFace dir = event.getDirection();
|
||||||
int x = dir.getModX(),
|
|
||||||
y = dir.getModY(),
|
|
||||||
z = dir.getModZ();
|
|
||||||
|
|
||||||
for (int i = event.getBlocks().size() - 1; i >= 0; i--) {
|
for (int i = event.getBlocks().size() - 1; i >= 0; i--) {
|
||||||
Location oldLoc = event.getBlocks().get(i).getLocation();
|
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);
|
Long bp = Jobs.getBpManager().getTime(oldLoc);
|
||||||
if (bp != null) {
|
|
||||||
Jobs.getBpManager().addP(newLoc, bp, false, true);
|
if (bp == null)
|
||||||
Jobs.getBpManager().remove(oldLoc);
|
continue;
|
||||||
}
|
Jobs.getBpManager().addP(newLoc, bp, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,19 +40,15 @@ public class PistonProtectionListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
BlockFace dir = event.getDirection();
|
BlockFace dir = event.getDirection();
|
||||||
int x = dir.getModX(),
|
|
||||||
y = dir.getModY(),
|
|
||||||
z = dir.getModZ();
|
|
||||||
|
|
||||||
List<Block> blocks = Util.getPistonRetractBlocks(event);
|
List<Block> blocks = Util.getPistonRetractBlocks(event);
|
||||||
for (int i = blocks.size() - 1; i >= 0; i--) {
|
for (int i = blocks.size() - 1; i >= 0; i--) {
|
||||||
Location oldLoc = blocks.get(i).getLocation();
|
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);
|
Long bp = Jobs.getBpManager().getTime(oldLoc);
|
||||||
if (bp != null) {
|
if (bp == null)
|
||||||
Jobs.getBpManager().addP(newLoc, bp, false, true);
|
continue;
|
||||||
Jobs.getBpManager().remove(oldLoc);
|
Jobs.getBpManager().addP(newLoc, bp, false, true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user