From 7efaa3b0fd31d25d42f56f0e43ba1e0497d384a3 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 22 Jul 2017 03:59:41 +0200 Subject: [PATCH] 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.) --- .../ryanhamshire/GriefPrevention/WorldGuardWrapper.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/me/ryanhamshire/GriefPrevention/WorldGuardWrapper.java b/src/me/ryanhamshire/GriefPrevention/WorldGuardWrapper.java index 335845d..eccbf87 100644 --- a/src/me/ryanhamshire/GriefPrevention/WorldGuardWrapper.java +++ b/src/me/ryanhamshire/GriefPrevention/WorldGuardWrapper.java @@ -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;