mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-08 01:08:23 +01:00
We need to invert block list to properly process moved blocks bp
This commit is contained in:
parent
0df98f0246
commit
2d2b6ccb60
@ -1,5 +1,7 @@
|
|||||||
package com.gamingmesh.jobs.listeners;
|
package com.gamingmesh.jobs.listeners;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
@ -10,6 +12,7 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
|
|||||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
|
import com.gamingmesh.jobs.stuff.Debug;
|
||||||
|
|
||||||
public class PistonProtectionListener implements Listener {
|
public class PistonProtectionListener implements Listener {
|
||||||
|
|
||||||
@ -30,10 +33,10 @@ public class PistonProtectionListener implements Listener {
|
|||||||
int x = dir.getModX(),
|
int x = dir.getModX(),
|
||||||
y = dir.getModY(),
|
y = dir.getModY(),
|
||||||
z = dir.getModZ();
|
z = dir.getModZ();
|
||||||
for (Block one : event.getBlocks()) {
|
for (int i = event.getBlocks().size() - 1; i >= 0; i--) {
|
||||||
|
Block one = event.getBlocks().get(i);
|
||||||
Location oldLoc = one.getLocation();
|
Location oldLoc = one.getLocation();
|
||||||
Location newLoc = oldLoc.clone().add(x, y, z);
|
Location newLoc = oldLoc.clone().add(x, y, z);
|
||||||
|
|
||||||
Long bp = Jobs.getBpManager().getTime(oldLoc);
|
Long bp = Jobs.getBpManager().getTime(oldLoc);
|
||||||
if (bp != null) {
|
if (bp != null) {
|
||||||
Jobs.getBpManager().addP(newLoc, bp, true, true);
|
Jobs.getBpManager().addP(newLoc, bp, true, true);
|
||||||
@ -59,8 +62,9 @@ public class PistonProtectionListener implements Listener {
|
|||||||
int x = dir.getModX(),
|
int x = dir.getModX(),
|
||||||
y = dir.getModY(),
|
y = dir.getModY(),
|
||||||
z = dir.getModZ();
|
z = dir.getModZ();
|
||||||
|
List<Block> blocks = Jobs.getNms().getPistonRetractBlocks(event);
|
||||||
for (Block one : Jobs.getNms().getPistonRetractBlocks(event)) {
|
for (int i = blocks.size() - 1; i >= 0; i--) {
|
||||||
|
Block one = blocks.get(i);
|
||||||
Location oldLoc = one.getLocation();
|
Location oldLoc = one.getLocation();
|
||||||
Location newLoc = oldLoc.clone().add(x, y, z);
|
Location newLoc = oldLoc.clone().add(x, y, z);
|
||||||
Long bp = Jobs.getBpManager().getTime(oldLoc);
|
Long bp = Jobs.getBpManager().getTime(oldLoc);
|
||||||
|
Loading…
Reference in New Issue
Block a user