From 909f605343b8332333cbbb224aa00b4baa79ec9d Mon Sep 17 00:00:00 2001 From: flatbmx Date: Sat, 8 Sep 2012 11:22:18 -0500 Subject: [PATCH] fixed default build if there was no region at location. --- .../factions/integration/Worldguard.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/com/massivecraft/factions/integration/Worldguard.java b/src/com/massivecraft/factions/integration/Worldguard.java index e5807db8..8c05f188 100644 --- a/src/com/massivecraft/factions/integration/Worldguard.java +++ b/src/com/massivecraft/factions/integration/Worldguard.java @@ -75,7 +75,10 @@ public class Worldguard ApplicableRegionSet set = regionManager.getApplicableRegions(pt); return set.allows(DefaultFlag.PVP); } - + // Check if player can build at location by worldguards rules. + // Returns: + // True: Player can build in the region. + // False: Player can not build in the region. public static boolean playerCanBuild(Player player, Location loc) { if( ! enabled) @@ -83,7 +86,13 @@ public class Worldguard // No WG hooks so we'll always bypass this check. return false; } - return wg.canBuild(player, loc); + + World world = loc.getWorld(); + Vector pt = toVector(loc); + + if (wg.getRegionManager(world).getApplicableRegions(pt).size() > 0) + return wg.canBuild(player, loc); + return false; } // Check for Regions in chunk the chunk