From 005ac41820ba3eb8da25cae59dc8cb469fec590c Mon Sep 17 00:00:00 2001 From: sk89q Date: Sun, 30 Jan 2011 01:36:59 -0800 Subject: [PATCH] Added PvP default flag. --- config.yml | 1 + src/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java | 1 + src/com/sk89q/worldguard/protection/ApplicableRegionSet.java | 4 +++- src/com/sk89q/worldguard/protection/GlobalFlags.java | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config.yml b/config.yml index e6f59528..c56144a2 100644 --- a/config.yml +++ b/config.yml @@ -73,6 +73,7 @@ regions: default: build: true chest-access: false + pvp: true blacklist: logging: diff --git a/src/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java b/src/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java index 5f9e9dc7..2f713c4a 100644 --- a/src/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java +++ b/src/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java @@ -301,6 +301,7 @@ public void loadConfiguration() { regionWand = config.getInt("regions.wand", 287); globalFlags.canBuild = config.getBoolean("regions.default.build", true); globalFlags.canAccessChests = config.getBoolean("regions.default.chest-access", false); + globalFlags.canPvP = config.getBoolean("regions.default.pvp", true); try { regionLoader.load(); diff --git a/src/com/sk89q/worldguard/protection/ApplicableRegionSet.java b/src/com/sk89q/worldguard/protection/ApplicableRegionSet.java index 4fe499c2..268ca4bb 100644 --- a/src/com/sk89q/worldguard/protection/ApplicableRegionSet.java +++ b/src/com/sk89q/worldguard/protection/ApplicableRegionSet.java @@ -68,9 +68,11 @@ public boolean canBuild(LocalPlayer player) { */ public boolean allowsFlag(String flag) { boolean def = true; - + if (flag.equals(AreaFlags.FLAG_CHEST_ACCESS)) { def = global.canAccessChests; + } else if (flag.equals(AreaFlags.FLAG_PVP)) { + def = global.canPvP; } return isFlagAllowed(flag, def, null); diff --git a/src/com/sk89q/worldguard/protection/GlobalFlags.java b/src/com/sk89q/worldguard/protection/GlobalFlags.java index 835ae723..219e4026 100644 --- a/src/com/sk89q/worldguard/protection/GlobalFlags.java +++ b/src/com/sk89q/worldguard/protection/GlobalFlags.java @@ -27,4 +27,5 @@ public class GlobalFlags { public boolean canBuild = true; public boolean canAccessChests = false; + public boolean canPvP = true; }