Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some more piston cases #1083

Merged
merged 2 commits into from Oct 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -532,6 +532,9 @@ private void onPistonEvent(BlockPistonEvent event, List<Block> blocks, boolean i
// If no blocks are moving, quickly check if another claim's boundaries are violated.
if (blocks.isEmpty())
{
// No block and retraction is always safe.
if (isRetract) return;

Block invadedBlock = pistonBlock.getRelative(direction);
Claim invadedClaim = this.dataStore.getClaimAt(invadedBlock.getLocation(), false, pistonClaim);
if (invadedClaim != null && (pistonClaim == null || !Objects.equals(pistonClaim.getOwnerID(), invadedClaim.getOwnerID())))
Expand Down Expand Up @@ -587,6 +590,9 @@ private void onPistonEvent(BlockPistonEvent event, List<Block> blocks, boolean i
return;
}

// Ensure we have top level claim - piston ownership is only checked based on claim owner in everywhere mode.
while (pistonClaim != null && pistonClaim.parent != null) pistonClaim = pistonClaim.parent;

// Pushing down or pulling up is safe if all blocks are in line with the piston.
if (minX == maxX && minZ == maxZ && direction == (isRetract ? BlockFace.UP : BlockFace.DOWN)) return;

Expand Down