Allow __global__ BUILD to be set to DENY.

This commit is contained in:
sk89q 2014-08-16 13:55:54 -07:00
parent a35aaf9659
commit 4597849466
2 changed files with 3 additions and 2 deletions

View File

@ -420,7 +420,8 @@ public <V> V getEffectiveFlag(final ProtectedRegion region, Flag<V> flag, @Nulla
} else if (flag == DefaultFlag.BUILD) {
// Legacy behavior -> we can't let people change BUILD on
// the global region
return null;
State value = region.getFlag(DefaultFlag.BUILD);
return value != State.ALLOW ? (V) value : null;
}
}

View File

@ -1979,7 +1979,7 @@ public void testGetEffectiveFlagGlobalRegionBuildDeny() throws Exception {
FlagValueCalculator result = mock.getFlagCalculator();
// Cannot let users override BUILD on GLOBAL
assertThat(result.getEffectiveFlag(global, DefaultFlag.BUILD, null), equalTo(null));
assertThat(result.getEffectiveFlag(global, DefaultFlag.BUILD, null), equalTo(State.DENY));
}
@Test