Added WorldGuard region building overriding safezone build rules if enabled.

This commit is contained in:
flatbmx 2012-09-08 11:02:36 -05:00
parent 1751702dc1
commit 774d013cd0
4 changed files with 20 additions and 2 deletions

View File

@ -74,6 +74,7 @@ public class Conf
public static boolean removePlayerDataWhenBanned = true;
public static boolean worldGuardChecking = false;
public static boolean worldGuardBuildPriority = false;
//LWC
public static boolean lwcIntegration = false;

View File

@ -112,7 +112,7 @@ public class P extends MPlugin
CapiFeatures.setup();
LWCFeatures.setup();
if(Conf.worldGuardChecking)
if(Conf.worldGuardChecking || Conf.worldGuardBuildPriority)
{
Worldguard.init(this);
}

View File

@ -75,7 +75,17 @@ public class Worldguard
ApplicableRegionSet set = regionManager.getApplicableRegions(pt);
return set.allows(DefaultFlag.PVP);
}
public static boolean playerCanBuild(Player player, Location loc)
{
if( ! enabled)
{
// No WG hooks so we'll always bypass this check.
return false;
}
return wg.canBuild(player, loc);
}
// Check for Regions in chunk the chunk
// Returns:
// True: Regions found within chunk

View File

@ -20,6 +20,7 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Worldguard;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation;
@ -182,6 +183,12 @@ public class FactionsBlockListener implements Listener
}
else if (otherFaction.isSafeZone())
{
if (Conf.worldGuardBuildPriority)
{
if (Worldguard.playerCanBuild(player, location))
return true;
}
if (!Conf.safeZoneDenyBuild || Permission.MANAGE_SAFE_ZONE.has(player))
return true;