From c0d4ba5c6c05faf6612177708c603e276d72f7f4 Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 15 Aug 2014 13:54:33 -0700 Subject: [PATCH] Swap the if() in the state flag test to make it more readable. --- .../protection/ApplicableRegionSet.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/sk89q/worldguard/protection/ApplicableRegionSet.java b/src/main/java/com/sk89q/worldguard/protection/ApplicableRegionSet.java index ed662e6c..650e59ba 100644 --- a/src/main/java/com/sk89q/worldguard/protection/ApplicableRegionSet.java +++ b/src/main/java/com/sk89q/worldguard/protection/ApplicableRegionSet.java @@ -284,15 +284,18 @@ private State calculateState(StateFlag flag, @Nullable LocalPlayer player, @Null } } - if (regionsThatCountExistHere) { - if (player != null) { - State membership = allowOrNone(needsClear.isEmpty()); - return combine(state, membership); + if (player != null) { + State fallback; + + if (regionsThatCountExistHere) { + fallback = allowOrNone(needsClear.isEmpty()); } else { - return combine(state, getDefault(flag, null)); + fallback = getDefault(flag, player); } + + return combine(state, fallback); } else { - return combine(getDefault(flag, player)); + return combine(state, getDefault(flag, null)); } }