From a8b54757e9305adfde1c385a838216cb01556d44 Mon Sep 17 00:00:00 2001 From: Redecouverte Date: Mon, 28 Feb 2011 18:36:19 +0100 Subject: [PATCH] fixed /region info and region flag fallback --- .../bukkit/commands/CommandRegionInfo.java | 2 +- .../protection/ApplicableRegionSet.java | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/com/sk89q/worldguard/bukkit/commands/CommandRegionInfo.java b/src/com/sk89q/worldguard/bukkit/commands/CommandRegionInfo.java index d66ff767..429fc01f 100644 --- a/src/com/sk89q/worldguard/bukkit/commands/CommandRegionInfo.java +++ b/src/com/sk89q/worldguard/bukkit/commands/CommandRegionInfo.java @@ -81,7 +81,7 @@ public boolean handle(CommandSender sender, String senderName, String command, S s.append(", "); } - s.append(flags.getFlag(nfo.type).toString()); + s.append(nfo.name + ": " + flags.getFlag(nfo.type).toString()); } sender.sendMessage(ChatColor.BLUE + "Flags: " + s.toString()); diff --git a/src/com/sk89q/worldguard/protection/ApplicableRegionSet.java b/src/com/sk89q/worldguard/protection/ApplicableRegionSet.java index beb7de1d..4b5f2866 100644 --- a/src/com/sk89q/worldguard/protection/ApplicableRegionSet.java +++ b/src/com/sk89q/worldguard/protection/ApplicableRegionSet.java @@ -73,20 +73,29 @@ public boolean isStateFlagAllowed(FlagType type) { return isStateFlagAllowed(type, global.getDefaultValue(type)); } - public boolean isStateFlagAllowed(FlagType type, LocalPlayer player) { - return isStateFlagAllowed(type, global.getDefaultValue(type)) || this.isMember(player); - } - public boolean isStateFlagAllowed(FlagType type, boolean def) { - State defState = def ? State.ALLOW : State.DENY; - return getStateFlag(type, true).getValue(defState) == State.ALLOW; + if(!this.isAnyRegionAffected()) + { + return def; + } + + return getStateFlag(type, true).getValue(State.DENY) == State.ALLOW; + } + + public boolean isStateFlagAllowed(FlagType type, LocalPlayer player) { + + return isStateFlagAllowed(type, global.getDefaultValue(type), player); } public boolean isStateFlagAllowed(FlagType type, boolean def, LocalPlayer player) { - State defState = def ? State.ALLOW : State.DENY; - return getStateFlag(type, true).getValue(defState) == State.ALLOW || this.isMember(player); + if(!this.isAnyRegionAffected()) + { + return def; + } + + return getStateFlag(type, true).getValue(State.DENY) == State.ALLOW || this.isMember(player); }