Skip to content

Commit

Permalink
Fix allow_other_regions_to_overlap = none from interfering with dista…
Browse files Browse the repository at this point in the history
…nce_between_claims
  • Loading branch information
espidev committed Dec 27, 2021
1 parent 69860cb commit 534ba26
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main/java/dev/espi/protectionstones/BlockHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,22 @@ private static boolean isFarEnoughFromOtherClaims(PSProtectBlock blockOptions, W

ProtectedRegion td = new ProtectedCuboidRegion("regionRadiusTest" + (long) (bx + by + bz), true, min, max);
td.setPriority(blockOptions.priority);
return !WGUtils.overlapsStrongerRegion(w, td, lp);
RegionManager rgm = WGUtils.getRegionManagerWithWorld(w);

// if the radius test region overlaps an unowned region
if (rgm.overlapsUnownedRegion(td, lp)) {
for (ProtectedRegion rg : rgm.getApplicableRegions(td)) {
if (ProtectionStones.isPSRegion(rg)) {
// if it is a PS region, then it is not far enough
return false;
} else if (rg.getPriority() >= td.getPriority()) {
// if the priorities are the same for plain WorldGuard regions, it is not far enough
return false;
}
}
}

return true;
}

// create PS region from a block place event
Expand Down

0 comments on commit 534ba26

Please sign in to comment.