Handle multiple related flags more like in WG 5.

This commit is contained in:
sk89q 2014-08-24 18:34:14 -07:00
parent b11d416035
commit 5fcd7ddf7a
13 changed files with 147 additions and 177 deletions

View File

@ -48,9 +48,11 @@ MySQL support has been completely overhauled. It should now be faster, no longer
For users of MySQL, WorldGuard now only saves changed and deleted regions when saving region data. No longer does WorldGuard have to rewrite the entire region database on each save.
### Improved handling of multiple related-flags
### Improved handling of related flags
Multiple flags that apply to an event are now evaluated together. For example, if a player right clicks a bed to sleep in it, both the `BUILD` flag, the `SLEEP` flag, and the player's membership level is considered. If one of those flags is set to `DENY`, then the player will be prevented from sleeping. If none of the flags or membership gives the player permission to sleep, it is possible to set `SLEEP` to `ALLOW` and allow players to _only_ sleep.
Multiple flags that apply to an event are now evaluated together if they are similar. For example, if a player right clicks a bed to sleep in it, both the `USE` and `SLEEP` flag are checked since they are both interaction-related. If one of them is `DENY`, then sleeping is denied (remember, `DENY` overrides `ALLOW`). If one of them is `ALLOW` and the other is not `DENY`, then sleeping is permitted.
Only one "category" of flags needs to evaluate to true to permit an action. `DENY` will not cross categories. For example, if `BUILD` is deny, it will not override `SLEEP`, so if `SLEEP` is set to `ALLOW`, sleeping will be permitted. This is fairly similar to how it worked on WorldGuard 5.
### Flag groups now work properly

View File

@ -87,9 +87,11 @@ MySQL support has been completely overhauled. It should now be faster, no longer
For users of MySQL, WorldGuard now only saves changed and deleted regions when saving region data. No longer does WorldGuard have to rewrite the entire region database on each save.
### Improved handling of multiple related-flags
### Improved handling of related flags
Multiple flags that apply to an event are now evaluated together. For example, if a player right clicks a bed to sleep in it, both the `BUILD` flag, the `SLEEP` flag, and the player's membership level is considered. If one of those flags is set to `DENY`, then the player will be prevented from sleeping. If none of the flags or membership gives the player permission to sleep, it is possible to set `SLEEP` to `ALLOW` and allow players to _only_ sleep.
Multiple flags that apply to an event are now evaluated together if they are similar. For example, if a player right clicks a bed to sleep in it, both the `USE` and `SLEEP` flag are checked since they are both interaction-related. If one of them is `DENY`, then sleeping is denied (remember, `DENY` overrides `ALLOW`). If one of them is `ALLOW` and the other is not `DENY`, then sleeping is permitted.
Only one "category" of flags needs to evaluate to true to permit an action. `DENY` will not cross categories. For example, if `BUILD` is deny, it will not override `SLEEP`, so if `SLEEP` is set to `ALLOW`, sleeping will be permitted. This is fairly similar to how it worked on WorldGuard 5.
### Flag groups now work properly

View File

@ -105,60 +105,6 @@ public class RegionQuery {
}
}
/**
* Test whether the given flags evaluate to {@code ALLOW}, implicitly also
* considering the {@link DefaultFlag#BUILD} flag.
*
* <p>This method is equivalent to calling
* {@link #testState(Location, Player, StateFlag...)} with
* {@code flags} plus the {@code BUILD} flag.</p>
*
* <p>This method does not check the region bypass permission. That must
* be done by the calling code.</p>
*
* @param location the location
* @param player the player
* @param flags zero or more flags
* @return true if permission is granted
* @see RegionResultSet#testBuild(RegionAssociable, StateFlag...)
*/
public boolean testBuild(Location location, Player player, StateFlag... flags) {
checkNotNull(location);
checkNotNull(player);
LocalPlayer localPlayer = plugin.wrapPlayer(player);
return testBuild(location, localPlayer, flags);
}
/**
* Test whether the given flags evaluate to {@code ALLOW}, implicitly also
* considering the {@link DefaultFlag#BUILD} flag.
*
* <p>This method is equivalent to calling
* {@link #testState(Location, Player, StateFlag...)} with
* {@code flags} plus the {@code BUILD} flag.</p>
*
* <p>This method does not check the region bypass permission. That must
* be done by the calling code.</p>
*
* @param location the location
* @param subject the subject
* @param flags zero or more flags
* @return true if permission is granted
* @see RegionResultSet#testBuild(RegionAssociable, StateFlag...)
*/
public boolean testBuild(Location location, RegionAssociable subject, StateFlag... flags) {
checkNotNull(location);
checkNotNull(subject);
checkNotNull(flags);
World world = location.getWorld();
WorldConfiguration worldConfig = config.get(world);
return !worldConfig.useRegions || getApplicableRegions(location).testBuild(subject, flags);
}
/**
* Test whether the (effective) value for a list of state flags equals
* {@code ALLOW}.
@ -182,6 +128,29 @@ public class RegionQuery {
return StateFlag.test(queryState(location, player, flag));
}
/**
* Test whether the (effective) value for a list of state flags equals
* {@code ALLOW}.
*
* <p>{@code player} can be non-null to satisfy region group requirements,
* otherwise it will be assumed that the caller that is not a member of any
* regions. (Flags on a region can be changed so that they only apply
* to certain users.) The player argument is required if the
* {@link DefaultFlag#BUILD} flag is in the list of flags.</p>
*
* <p>This method does not check the region bypass permission. That must
* be done by the calling code.</p>
*
* @param location the location
* @param associable an optional associable
* @param flag the flag
* @return true if the result was {@code ALLOW}
* @see RegionResultSet#queryValue(RegionAssociable, Flag)
*/
public boolean testState(Location location, @Nullable RegionAssociable associable, StateFlag... flag) {
return StateFlag.test(queryState(location, associable, flag));
}
/**
* Get the (effective) value for a list of state flags. The rules of
* states is observed here; that is, {@code DENY} overrides {@code ALLOW},
@ -205,6 +174,28 @@ public class RegionQuery {
return getApplicableRegions(location).queryState(localPlayer, flags);
}
/**
* Get the (effective) value for a list of state flags. The rules of
* states is observed here; that is, {@code DENY} overrides {@code ALLOW},
* and {@code ALLOW} overrides {@code NONE}. One flag may override another.
*
* <p>{@code player} can be non-null to satisfy region group requirements,
* otherwise it will be assumed that the caller that is not a member of any
* regions. (Flags on a region can be changed so that they only apply
* to certain users.) The player argument is required if the
* {@link DefaultFlag#BUILD} flag is in the list of flags.</p>
*
* @param location the location
* @param associable an optional associable
* @param flags a list of flags to check
* @return a state
* @see RegionResultSet#queryState(RegionAssociable, StateFlag...)
*/
@Nullable
public State queryState(Location location, @Nullable RegionAssociable associable, StateFlag... flags) {
return getApplicableRegions(location).queryState(associable, flags);
}
/**
* Get the effective value for a flag. If there are multiple values
* (for example, multiple overlapping regions with
@ -235,6 +226,35 @@ public class RegionQuery {
return getApplicableRegions(location).queryValue(localPlayer, flag);
}
/**
* Get the effective value for a flag. If there are multiple values
* (for example, multiple overlapping regions with
* the same priority may have the same flag set), then the selected
* (or "winning") value will depend on the flag type.
*
* <p>Only some flag types actually have a strategy for picking the
* "best value." For most types, the actual value that is chosen to be
* returned is undefined (it could be any value). As of writing, the only
* type of flag that actually has a strategy for picking a value is the
* {@link StateFlag}.</p>
*
* <p>{@code player} can be non-null to satisfy region group requirements,
* otherwise it will be assumed that the caller that is not a member of any
* regions. (Flags on a region can be changed so that they only apply
* to certain users.) The player argument is required if the
* {@link DefaultFlag#BUILD} flag is the flag being queried.</p>
*
* @param location the location
* @param associable an optional associable
* @param flag the flag
* @return a value, which could be {@code null}
* @see RegionResultSet#queryValue(RegionAssociable, Flag)
*/
@Nullable
public <V> V queryValue(Location location, @Nullable RegionAssociable associable, Flag<V> flag) {
return getApplicableRegions(location).queryValue(associable, flag);
}
/**
* Get the effective values for a flag, returning a collection of all
* values. It is up to the caller to determine which value, if any,
@ -257,4 +277,25 @@ public class RegionQuery {
return getApplicableRegions(location).queryAllValues(localPlayer, flag);
}
/**
* Get the effective values for a flag, returning a collection of all
* values. It is up to the caller to determine which value, if any,
* from the collection will be used.
*
* <p>{@code player} can be non-null to satisfy region group requirements,
* otherwise it will be assumed that the caller that is not a member of any
* regions. (Flags on a region can be changed so that they only apply
* to certain users.) The player argument is required if the
* {@link DefaultFlag#BUILD} flag is the flag being queried.</p>
*
* @param location the location
* @param associable an optional associable
* @param flag the flag
* @return a collection of values
* @see RegionResultSet#queryAllValues(RegionAssociable, Flag)
*/
public <V> Collection<V> queryAllValues(Location location, @Nullable RegionAssociable associable, Flag<V> flag) {
return getApplicableRegions(location).queryAllValues(associable, flag);
}
}

View File

@ -27,6 +27,7 @@ import com.sk89q.worldguard.bukkit.event.block.BreakBlockEvent;
import com.sk89q.worldguard.bukkit.event.block.PlaceBlockEvent;
import com.sk89q.worldguard.bukkit.event.entity.SpawnEntityEvent;
import com.sk89q.worldguard.bukkit.util.Materials;
import com.sk89q.worldguard.protection.association.RegionAssociable;
import com.sk89q.worldguard.protection.flags.DefaultFlag;
import com.sk89q.worldguard.protection.flags.StateFlag;
import org.bukkit.Location;
@ -134,7 +135,7 @@ public class RegionFlagsListener extends AbstractListener {
return new Predicate<Location>() {
@Override
public boolean apply(@Nullable Location location) {
return query.testState(location, null, flag);
return query.testState(location, (RegionAssociable) null, flag);
}
};
}

View File

@ -174,12 +174,13 @@ public class RegionProtectionListener extends AbstractListener {
/* Flint and steel, fire charge, etc. */
if (type == Material.FIRE) {
canPlace = query.testBuild(target, associable, DefaultFlag.BLOCK_PLACE, DefaultFlag.LIGHTER);
canPlace = query.testState(target, associable, DefaultFlag.BUILD, DefaultFlag.BLOCK_PLACE)
|| query.testState(target, associable, DefaultFlag.LIGHTER);
what = "place fire";
/* Everything else */
} else {
canPlace = query.testBuild(target, associable, DefaultFlag.BLOCK_PLACE);
canPlace = query.testState(target, associable, DefaultFlag.BUILD, DefaultFlag.BLOCK_PLACE);
what = "place that block";
}
@ -211,12 +212,13 @@ public class RegionProtectionListener extends AbstractListener {
/* TNT */
if (event.getCause().find(EntityType.PRIMED_TNT, EntityType.PRIMED_TNT) != null) {
canBreak = query.testBuild(target, associable, DefaultFlag.BLOCK_BREAK, DefaultFlag.TNT);
canBreak = query.testState(target, associable, DefaultFlag.BUILD, DefaultFlag.BLOCK_BREAK)
|| query.testState(target, associable, DefaultFlag.TNT);
what = "dynamite blocks";
/* Everything else */
} else {
canBreak = query.testBuild(target, associable, DefaultFlag.BLOCK_BREAK);
canBreak = query.testState(target, associable, DefaultFlag.BUILD, DefaultFlag.BLOCK_BREAK);
what = "break that block";
}
@ -248,22 +250,26 @@ public class RegionProtectionListener extends AbstractListener {
/* Inventory */
if (Materials.isInventoryBlock(type)) {
canUse = query.testBuild(target, associable, DefaultFlag.USE, DefaultFlag.CHEST_ACCESS);
canUse = query.testState(target, associable, DefaultFlag.BUILD)
|| query.testState(target, associable, DefaultFlag.USE, DefaultFlag.CHEST_ACCESS);
what = "open that";
/* Beds */
} else if (type == Material.BED_BLOCK) {
canUse = query.testBuild(target, associable, DefaultFlag.USE, DefaultFlag.SLEEP);
canUse = query.testState(target, associable, DefaultFlag.BUILD)
|| query.testState(target, associable, DefaultFlag.USE, DefaultFlag.SLEEP);
what = "sleep";
/* TNT */
} else if (type == Material.TNT) {
canUse = query.testBuild(target, associable, DefaultFlag.TNT);
canUse = query.testState(target, associable, DefaultFlag.BUILD)
|| query.testState(target, associable, DefaultFlag.TNT);
what = "use explosives";
/* Everything else */
} else {
canUse = query.testBuild(target, associable, DefaultFlag.USE);
canUse = query.testState(target, associable, DefaultFlag.BUILD)
|| query.testState(target, associable, DefaultFlag.USE);
what = "use that";
}
@ -293,17 +299,19 @@ public class RegionProtectionListener extends AbstractListener {
/* Vehicles */
if (Entities.isVehicle(type)) {
canSpawn = query.testBuild(target, associable, DefaultFlag.PLACE_VEHICLE);
canSpawn = query.testState(target, associable, DefaultFlag.BUILD)
|| query.testState(target, associable, DefaultFlag.PLACE_VEHICLE);
what = "place vehicles";
/* Item pickup */
} else if (event.getEntity() instanceof Item) {
canSpawn = query.testBuild(target, associable, DefaultFlag.ITEM_DROP);
canSpawn = query.testState(target, associable, DefaultFlag.BUILD)
|| query.testState(target, associable, DefaultFlag.ITEM_DROP);
what = "drop items";
/* Everything else */
} else {
canSpawn = query.testBuild(target, associable);
canSpawn = query.testState(target, associable, DefaultFlag.BUILD);
if (event.getEntity() instanceof Item) {
what = "drop items";
@ -333,17 +341,19 @@ public class RegionProtectionListener extends AbstractListener {
/* Vehicles */
if (Entities.isVehicle(type)) {
canDestroy = query.testBuild(target, associable, DefaultFlag.DESTROY_VEHICLE);
canDestroy = query.testState(target, associable, DefaultFlag.BUILD)
|| query.testState(target, associable, DefaultFlag.DESTROY_VEHICLE);
what = "break vehicles";
/* Item pickup */
} else if (event.getEntity() instanceof Item) {
canDestroy = query.testBuild(target, associable, DefaultFlag.ITEM_PICKUP);
canDestroy = query.testState(target, associable, DefaultFlag.BUILD)
|| query.testState(target, associable, DefaultFlag.ITEM_PICKUP);
what = "pick up items";
/* Everything else */
} else {
canDestroy = query.testBuild(target, associable);
canDestroy = query.testState(target, associable, DefaultFlag.BUILD);
what = "break things";
}
@ -362,7 +372,7 @@ public class RegionProtectionListener extends AbstractListener {
RegionAssociable associable = createRegionAssociable(event.getCause());
RegionQuery query = getPlugin().getRegionContainer().createQuery();
boolean canUse = query.testBuild(target, associable, DefaultFlag.USE);
boolean canUse = query.testState(target, associable, DefaultFlag.BUILD) || query.testState(target, associable, DefaultFlag.USE);
String what = "use that";
if (!canUse) {
@ -393,7 +403,7 @@ public class RegionProtectionListener extends AbstractListener {
} else if (event.getEntity() instanceof Player && (attacker = event.getCause().getFirstPlayer()) != null && !attacker.equals(event.getEntity())) {
Player defender = (Player) event.getEntity();
canDamage = query.testBuild(target, associable, DefaultFlag.PVP)
canDamage = query.testState(target, associable, DefaultFlag.BUILD) || query.testState(target, associable, DefaultFlag.PVP)
&& query.queryState(attacker.getLocation(), attacker, DefaultFlag.PVP) != State.DENY;
// Fire the disallow PVP event
@ -405,7 +415,7 @@ public class RegionProtectionListener extends AbstractListener {
/* Everything else */
} else {
canDamage = query.testBuild(target, associable, DefaultFlag.USE);
canDamage = query.testState(target, associable, DefaultFlag.BUILD) || query.testState(target, associable, DefaultFlag.USE);
what = "hit that";
}
@ -425,7 +435,7 @@ public class RegionProtectionListener extends AbstractListener {
if (!isWhitelisted(Cause.create(player), vehicle.getWorld())) {
RegionQuery query = getPlugin().getRegionContainer().createQuery();
Location location = vehicle.getLocation();
if (!query.testBuild(location, player, DefaultFlag.USE)) {
if (!query.testState(location, player, DefaultFlag.BUILD) && !query.testState(location, player, DefaultFlag.USE)) {
long now = System.currentTimeMillis();
Long lastTime = WGMetadata.getIfPresent(player, DISEMBARK_MESSAGE_KEY, Long.class);
if (lastTime == null || now - lastTime >= LAST_MESSAGE_DELAY) {

View File

@ -243,19 +243,11 @@ public class WorldGuardEntityListener implements Listener {
if (attacker != null) {
if (attacker instanceof TNTPrimed || attacker instanceof ExplosiveMinecart) {
// The check for explosion damage should be handled already... But... What ever...
if (wcfg.blockTNTExplosions) {
event.setCancelled(true);
return;
}
if (wcfg.useRegions && wcfg.explosionFlagCancellation) {
RegionQuery query = plugin.getRegionContainer().createQuery();
if (!query.testBuild(defender.getLocation(), (Player) defender, DefaultFlag.TNT)) {
event.setCancelled(true);
return;
}
}
}
if (attacker instanceof Fireball) {
@ -273,7 +265,7 @@ public class WorldGuardEntityListener implements Listener {
if (wcfg.useRegions) {
Fireball fireball = (Fireball) attacker;
RegionQuery query = plugin.getRegionContainer().createQuery();
if (!query.testBuild(defender.getLocation(), (Player) defender, DefaultFlag.GHAST_FIREBALL) && wcfg.explosionFlagCancellation) {
if (!query.testState(defender.getLocation(), (Player) defender, DefaultFlag.GHAST_FIREBALL) && wcfg.explosionFlagCancellation) {
event.setCancelled(true);
return;
}

View File

@ -65,33 +65,13 @@ public interface ApplicableRegionSet extends Iterable<ProtectedRegion> {
* Tests whether the {@link DefaultFlag#BUILD} flag or membership
* requirements permit the given player.
*
* <p>If there are several relevant flags (i.e. in addition to
* {@code BUILD}, such as {@link DefaultFlag#SLEEP} when the target
* object is a bed), then
* {@link #testBuild(RegionAssociable, StateFlag...)} should be used.</p>
*
* @param player the player to check
* @return true if permitted
* @deprecated use {@link #testBuild(RegionAssociable, StateFlag...)}
* @deprecated use {@link #testState(RegionAssociable, StateFlag...)}
*/
@Deprecated
boolean canBuild(LocalPlayer player);
/**
* Test whether the given flags evaluate to {@code ALLOW}, implicitly also
* considering the {@link DefaultFlag#BUILD} flag.
*
* <p>This method is equivalent to calling
* {@link #testState(RegionAssociable, StateFlag...)} with {@code flags} plus
* the {@code BUILD} flag.</p>
*
* @param subject the subject
* @param flags zero or more flags
* @return true if permission is granted
* @see #queryState(RegionAssociable, StateFlag...)
*/
boolean testBuild(RegionAssociable subject, StateFlag... flags);
/**
* Test whether the (effective) value for a list of state flags equals
* {@code ALLOW}.

View File

@ -56,11 +56,6 @@ public class FailedLoadRegionSet extends AbstractRegionSet {
return true;
}
@Override
public boolean testBuild(RegionAssociable subject, StateFlag... flags) {
return false;
}
@SuppressWarnings("unchecked")
@Nullable
@Override

View File

@ -222,36 +222,6 @@ public class FlagValueCalculator {
return queryValue(subject, flag);
}
/**
* Get the effective value for a list of state flags. The rules of
* states is observed here; that is, {@code DENY} overrides {@code ALLOW},
* and {@code ALLOW} overrides {@code NONE}.
*
* <p>This method is the same as
* {@link #queryState(RegionAssociable, StateFlag...)} except it allows
* another flag to be added at the beginning of the flag list without
* having to concatenate the vararg array with the first flag.</p>
*
* @param subject an optional subject, which would be used to determine the region group to apply
* @param flags a list of flags to check
* @return a state
*/
@Nullable
public State queryState(@Nullable RegionAssociable subject, StateFlag firstFlag, StateFlag... flags) {
State value = queryValue(subject, firstFlag);
if (value != State.DENY) {
for (StateFlag flag : flags) {
value = StateFlag.combine(value, queryValue(subject, flag));
if (value == State.DENY) {
break;
}
}
}
return value;
}
/**
* Get the effective value for a flag. If there are multiple values
* (for example, if there are multiple regions with the same priority

View File

@ -24,6 +24,8 @@ import com.sk89q.worldguard.bukkit.BukkitPlayer;
import com.sk89q.worldguard.bukkit.RegionContainer;
import com.sk89q.worldguard.bukkit.RegionQuery;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.association.RegionAssociable;
import com.sk89q.worldguard.protection.flags.DefaultFlag;
import com.sk89q.worldguard.protection.flags.StateFlag;
import com.sk89q.worldguard.protection.managers.RegionManager;
import org.bukkit.Location;
@ -158,7 +160,7 @@ public class GlobalRegionManager {
*/
@Deprecated
public boolean canBuild(Player player, Location location) {
return hasBypass(player, location.getWorld()) || createQuery().testBuild(location, player);
return hasBypass(player, location.getWorld()) || createQuery().testState(location, player, DefaultFlag.BUILD);
}
@ -216,7 +218,7 @@ public class GlobalRegionManager {
@Deprecated
public boolean allows(StateFlag flag, Location location, @Nullable LocalPlayer player) {
if (player == null) {
return StateFlag.test(createQuery().queryState(location, null, flag));
return StateFlag.test(createQuery().queryState(location, (RegionAssociable) null, flag));
} else if (player instanceof BukkitPlayer) {
Player p = ((BukkitPlayer) player).getPlayer();
return StateFlag.test(createQuery().queryState(location, p, flag));

View File

@ -51,11 +51,6 @@ public class PermissiveRegionSet extends AbstractRegionSet {
return true;
}
@Override
public boolean testBuild(RegionAssociable subject, StateFlag... flags) {
return true;
}
@SuppressWarnings("unchecked")
@Nullable
@Override

View File

@ -21,7 +21,6 @@ package com.sk89q.worldguard.protection;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.protection.association.RegionAssociable;
import com.sk89q.worldguard.protection.flags.DefaultFlag;
import com.sk89q.worldguard.protection.flags.Flag;
import com.sk89q.worldguard.protection.flags.StateFlag;
import com.sk89q.worldguard.protection.flags.StateFlag.State;
@ -36,7 +35,6 @@ import java.util.List;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldguard.protection.flags.StateFlag.test;
/**
* An implementation that calculates flags using a list of regions.
@ -81,12 +79,6 @@ public class RegionResultSet extends AbstractRegionSet {
return false;
}
@Override
public boolean testBuild(RegionAssociable subject, StateFlag... flags) {
checkNotNull(subject);
return test(flagValueCalculator.queryState(subject, DefaultFlag.BUILD, flags));
}
@Override
@Nullable
public State queryState(@Nullable RegionAssociable subject, StateFlag... flags) {

View File

@ -42,7 +42,7 @@ public class ApplicableRegionSetTest {
LocalPlayer player = mock.createPlayer();
ApplicableRegionSet set = mock.getApplicableSet();
assertThat(set.testBuild(player), is(true));
assertThat(set.testState(player, DefaultFlag.BUILD), is(true));
}
@Test
@ -54,7 +54,7 @@ public class ApplicableRegionSetTest {
ProtectedRegion global = mock.global();
ApplicableRegionSet set = mock.getApplicableSet();
assertThat(set.testBuild(player), is(true));
assertThat(set.testState(player, DefaultFlag.BUILD), is(true));
}
@Test
@ -68,8 +68,8 @@ public class ApplicableRegionSetTest {
region.getMembers().addPlayer(member);
ApplicableRegionSet set = mock.getApplicableSet();
assertThat(set.testBuild(member), is(true));
assertThat(set.testBuild(nonMember), is(false));
assertThat(set.testState(member, DefaultFlag.BUILD), is(true));
assertThat(set.testState(nonMember, DefaultFlag.BUILD), is(false));
}
@Test
@ -88,10 +88,7 @@ public class ApplicableRegionSetTest {
assertThat(set.testState(player, DefaultFlag.SEND_CHAT), is(true));
assertThat(set.testState(player, DefaultFlag.INVINCIBILITY), is(false));
assertThat(set.testBuild(player, DefaultFlag.CHEST_ACCESS), is(true));
assertThat(set.testBuild(player, DefaultFlag.SLEEP), is(true));
assertThat(set.testBuild(player, DefaultFlag.TNT), is(true));
assertThat(set.testBuild(player, DefaultFlag.PVP), is(true));
assertThat(set.testState(player, DefaultFlag.BUILD), is(true));
}
@Test
@ -112,10 +109,7 @@ public class ApplicableRegionSetTest {
assertThat(set.testState(player, DefaultFlag.SEND_CHAT), is(true));
assertThat(set.testState(player, DefaultFlag.INVINCIBILITY), is(false));
assertThat(set.testBuild(player, DefaultFlag.CHEST_ACCESS), is(true));
assertThat(set.testBuild(player, DefaultFlag.SLEEP), is(true));
assertThat(set.testBuild(player, DefaultFlag.TNT), is(true));
assertThat(set.testBuild(player, DefaultFlag.PVP), is(true));
assertThat(set.testState(player, DefaultFlag.BUILD), is(true));
}
@Test
@ -138,10 +132,7 @@ public class ApplicableRegionSetTest {
assertThat(set.testState(member, DefaultFlag.SEND_CHAT), is(true));
assertThat(set.testState(member, DefaultFlag.INVINCIBILITY), is(false));
assertThat(set.testBuild(member, DefaultFlag.CHEST_ACCESS), is(true));
assertThat(set.testBuild(member, DefaultFlag.SLEEP), is(true));
assertThat(set.testBuild(member, DefaultFlag.TNT), is(true));
assertThat(set.testBuild(member, DefaultFlag.PVP), is(true));
assertThat(set.testState(member, DefaultFlag.BUILD), is(true));
assertThat(set.testState(nonMember, DefaultFlag.MOB_DAMAGE), is(true));
assertThat(set.testState(nonMember, DefaultFlag.ENTRY), is(true));
@ -151,10 +142,7 @@ public class ApplicableRegionSetTest {
assertThat(set.testState(nonMember, DefaultFlag.SEND_CHAT), is(true));
assertThat(set.testState(nonMember, DefaultFlag.INVINCIBILITY), is(false));
assertThat(set.testBuild(nonMember, DefaultFlag.CHEST_ACCESS), is(false));
assertThat(set.testBuild(nonMember, DefaultFlag.SLEEP), is(false));
assertThat(set.testBuild(nonMember, DefaultFlag.TNT), is(false));
assertThat(set.testBuild(nonMember, DefaultFlag.PVP), is(false));
assertThat(set.testState(nonMember, DefaultFlag.BUILD), is(false));
}
@Test