Added WorldGuard region building overriding safezone build rules if enabled.
This commit is contained in:
parent
1751702dc1
commit
774d013cd0
@ -74,6 +74,7 @@ public class Conf
|
|||||||
public static boolean removePlayerDataWhenBanned = true;
|
public static boolean removePlayerDataWhenBanned = true;
|
||||||
|
|
||||||
public static boolean worldGuardChecking = false;
|
public static boolean worldGuardChecking = false;
|
||||||
|
public static boolean worldGuardBuildPriority = false;
|
||||||
|
|
||||||
//LWC
|
//LWC
|
||||||
public static boolean lwcIntegration = false;
|
public static boolean lwcIntegration = false;
|
||||||
|
@ -112,7 +112,7 @@ public class P extends MPlugin
|
|||||||
CapiFeatures.setup();
|
CapiFeatures.setup();
|
||||||
LWCFeatures.setup();
|
LWCFeatures.setup();
|
||||||
|
|
||||||
if(Conf.worldGuardChecking)
|
if(Conf.worldGuardChecking || Conf.worldGuardBuildPriority)
|
||||||
{
|
{
|
||||||
Worldguard.init(this);
|
Worldguard.init(this);
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,16 @@ public class Worldguard
|
|||||||
return set.allows(DefaultFlag.PVP);
|
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
|
// Check for Regions in chunk the chunk
|
||||||
// Returns:
|
// Returns:
|
||||||
// True: Regions found within chunk
|
// True: Regions found within chunk
|
||||||
|
@ -20,6 +20,7 @@ import com.massivecraft.factions.FPlayer;
|
|||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.P;
|
import com.massivecraft.factions.P;
|
||||||
|
import com.massivecraft.factions.integration.Worldguard;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
|
|
||||||
@ -182,6 +183,12 @@ public class FactionsBlockListener implements Listener
|
|||||||
}
|
}
|
||||||
else if (otherFaction.isSafeZone())
|
else if (otherFaction.isSafeZone())
|
||||||
{
|
{
|
||||||
|
if (Conf.worldGuardBuildPriority)
|
||||||
|
{
|
||||||
|
if (Worldguard.playerCanBuild(player, location))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Conf.safeZoneDenyBuild || Permission.MANAGE_SAFE_ZONE.has(player))
|
if (!Conf.safeZoneDenyBuild || Permission.MANAGE_SAFE_ZONE.has(player))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user