Skip to content

Commit

Permalink
Change worldguard-checking behaviour. (#160)
Browse files Browse the repository at this point in the history
Prevent players from creating a claim if _any_ part of their claim includes a worldguard region they cannot build in. (Previous behavior only prevented claiming if the entire claim was within a worldguard region the player could not build inside.)
  • Loading branch information
sleiss authored and RoboMWM committed Jul 22, 2017
1 parent 5d474e5 commit 7efaa3b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/me/ryanhamshire/GriefPrevention/WorldGuardWrapper.java
Expand Up @@ -12,6 +12,7 @@
import com.sk89q.worldguard.protection.flags.DefaultFlag;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;

class WorldGuardWrapper
{
Expand All @@ -38,7 +39,12 @@ public boolean canBuild(Location lesserCorner, Location greaterCorner, Player cr
new BlockVector(greaterCorner.getX(), world.getMaxHeight(), greaterCorner.getZ()));
ApplicableRegionSet overlaps = manager.getApplicableRegions(tempRegion);
LocalPlayer localPlayer = worldGuard.wrapPlayer(creatingPlayer);
return overlaps.testState(localPlayer, DefaultFlag.BUILD);
for (ProtectedRegion r : overlaps.getRegions()) {
if (!manager.getApplicableRegions(r).testState(localPlayer, DefaultFlag.BUILD)) {
return false;
}
}
return true;
}

return true;
Expand Down

0 comments on commit 7efaa3b

Please sign in to comment.