Change worldguard-checking behaviour. (#160)

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.)
This commit is contained in:
Simon 2017-07-22 03:59:41 +02:00 committed by RoboMWM
parent 5d474e51f5
commit 7efaa3b0fd

View File

@ -12,6 +12,7 @@ import com.sk89q.worldguard.protection.ApplicableRegionSet;
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
{
@ -38,7 +39,12 @@ class WorldGuardWrapper
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;