mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-27 21:15:57 +01:00
Reimplemented the quirks of the old flag code.
This commit is contained in:
parent
d9d665ab14
commit
cab42af53b
@ -22,6 +22,7 @@
|
|||||||
import com.sk89q.worldguard.LocalPlayer;
|
import com.sk89q.worldguard.LocalPlayer;
|
||||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||||
import com.sk89q.worldguard.protection.GlobalRegionManager;
|
import com.sk89q.worldguard.protection.GlobalRegionManager;
|
||||||
|
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||||
import com.sk89q.worldguard.protection.flags.Flag;
|
import com.sk89q.worldguard.protection.flags.Flag;
|
||||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||||
import com.sk89q.worldguard.protection.flags.StateFlag.State;
|
import com.sk89q.worldguard.protection.flags.StateFlag.State;
|
||||||
@ -96,10 +97,12 @@ public ApplicableRegionSet getApplicableRegions(Location location) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether the given player is permitted to modify or interact with
|
* Test whether the given flags evaluate to {@code ALLOW}, implicitly also
|
||||||
* blocks at the given location. Additional flags to be considered can be
|
* considering the {@link DefaultFlag#BUILD} flag.
|
||||||
* provided. The {@code BUILD} flag is already included in the list of
|
*
|
||||||
* flags considered.
|
* <p>This method is equivalent to calling
|
||||||
|
* {@link #testState(Location, Player, StateFlag...)} with
|
||||||
|
* {@code flags} plus the {@code BUILD} flag.</p>
|
||||||
*
|
*
|
||||||
* @param location the location
|
* @param location the location
|
||||||
* @param player the player
|
* @param player the player
|
||||||
@ -128,19 +131,14 @@ public boolean testBuild(Location location, Player player, StateFlag... flags) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the effective value for a flag. If there are multiple values
|
* Test whether the (effective) value for a list of state flags equals
|
||||||
* (for example, if there are multiple regions with the same priority
|
* {@code ALLOW}.
|
||||||
* but with different farewell messages set, there would be multiple
|
|
||||||
* completing values), then the selected (or "winning") value will depend
|
|
||||||
* on the flag type.
|
|
||||||
*
|
*
|
||||||
* <p>This method does <strong>not</strong> properly process build
|
* <p>{@code player} can be non-null to satisfy region group requirements,
|
||||||
* permissions. Instead, use {@link #testBuild(Location, Player, StateFlag...)}
|
* otherwise it will be assumed that the caller that is not a member of any
|
||||||
* for that purpose.</p>
|
* regions. (Flags on a region can be changed so that they only apply
|
||||||
*
|
* to certain users.) The player argument is required if the
|
||||||
* <p>This method does the same as
|
* {@link DefaultFlag#BUILD} flag is in the list of flags.</p>
|
||||||
* {@link #queryState(Location, Player, StateFlag...)} except that it
|
|
||||||
* returns a boolean when the result is {@code ALLOW}.</p>
|
|
||||||
*
|
*
|
||||||
* @param location the location
|
* @param location the location
|
||||||
* @param player an optional player, which would be used to determine the region group to apply
|
* @param player an optional player, which would be used to determine the region group to apply
|
||||||
@ -148,21 +146,20 @@ public boolean testBuild(Location location, Player player, StateFlag... flags) {
|
|||||||
* @return true if the result was {@code ALLOW}
|
* @return true if the result was {@code ALLOW}
|
||||||
* @see ApplicableRegionSet#queryValue(LocalPlayer, Flag)
|
* @see ApplicableRegionSet#queryValue(LocalPlayer, Flag)
|
||||||
*/
|
*/
|
||||||
public boolean testState(Location location, @Nullable Player player, StateFlag flag) {
|
public boolean testState(Location location, @Nullable Player player, StateFlag... flag) {
|
||||||
return StateFlag.test(queryState(location, player, flag));
|
return StateFlag.test(queryState(location, player, flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the effective value for a list of state flags. The rules of
|
* Get the (effective) value for a list of state flags. The rules of
|
||||||
* states is observed here; that is, {@code DENY} overrides {@code ALLOW},
|
* states is observed here; that is, {@code DENY} overrides {@code ALLOW},
|
||||||
* and {@code ALLOW} overrides {@code NONE}.
|
* and {@code ALLOW} overrides {@code NONE}. One flag may override another.
|
||||||
*
|
*
|
||||||
* <p>This method does <strong>not</strong> properly process build
|
* <p>{@code player} can be non-null to satisfy region group requirements,
|
||||||
* permissions. Instead, use {@link #testBuild(Location, Player, StateFlag...)}
|
* otherwise it will be assumed that the caller that is not a member of any
|
||||||
* for that purpose.</p>
|
* regions. (Flags on a region can be changed so that they only apply
|
||||||
*
|
* to certain users.) The player argument is required if the
|
||||||
* See {@link ApplicableRegionSet#queryState(LocalPlayer, StateFlag...)}
|
* {@link DefaultFlag#BUILD} flag is in the list of flags.</p>
|
||||||
* for more information.
|
|
||||||
*
|
*
|
||||||
* @param location the location
|
* @param location the location
|
||||||
* @param player an optional player, which would be used to determine the region groups that apply
|
* @param player an optional player, which would be used to determine the region groups that apply
|
||||||
@ -178,17 +175,21 @@ public State queryState(Location location, @Nullable Player player, StateFlag...
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the effective value for a flag. If there are multiple values
|
* Get the effective value for a flag. If there are multiple values
|
||||||
* (for example, if there are multiple regions with the same priority
|
* (for example, multiple overlapping regions with
|
||||||
* but with different farewell messages set, there would be multiple
|
* the same priority may have the same flag set), then the selected
|
||||||
* completing values), then the selected (or "winning") value will depend
|
* (or "winning") value will depend on the flag type.
|
||||||
* on the flag type.
|
|
||||||
*
|
*
|
||||||
* <p>This method does <strong>not</strong> properly process build
|
* <p>Only some flag types actually have a strategy for picking the
|
||||||
* permissions. Instead, use {@link #testBuild(Location, Player, StateFlag...)}
|
* "best value." For most types, the actual value that is chosen to be
|
||||||
* for that purpose.</p>
|
* 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>See {@link ApplicableRegionSet#queryValue(LocalPlayer, Flag)} for
|
* <p>{@code player} can be non-null to satisfy region group requirements,
|
||||||
* more information.</p>
|
* 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 location the location
|
||||||
* @param player an optional player, which would be used to determine the region group to apply
|
* @param player an optional player, which would be used to determine the region group to apply
|
||||||
@ -207,12 +208,11 @@ public <V> V queryValue(Location location, @Nullable Player player, Flag<V> flag
|
|||||||
* values. It is up to the caller to determine which value, if any,
|
* values. It is up to the caller to determine which value, if any,
|
||||||
* from the collection will be used.
|
* from the collection will be used.
|
||||||
*
|
*
|
||||||
* <p>This method does <strong>not</strong> properly process build
|
* <p>{@code player} can be non-null to satisfy region group requirements,
|
||||||
* permissions. Instead, use {@link #testBuild(Location, Player, StateFlag...)}
|
* otherwise it will be assumed that the caller that is not a member of any
|
||||||
* for that purpose.</p>
|
* regions. (Flags on a region can be changed so that they only apply
|
||||||
*
|
* to certain users.) The player argument is required if the
|
||||||
* <p>See {@link ApplicableRegionSet#queryAllValues(LocalPlayer, Flag)}
|
* {@link DefaultFlag#BUILD} flag is the flag being queried.</p>
|
||||||
* for more information.</p>
|
|
||||||
*
|
*
|
||||||
* @param location the location
|
* @param location the location
|
||||||
* @param player an optional player, which would be used to determine the region group to apply
|
* @param player an optional player, which would be used to determine the region group to apply
|
||||||
|
@ -97,43 +97,56 @@ public ApplicableRegionSet(SortedSet<ProtectedRegion> applicable, @Nullable Prot
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean canBuild(LocalPlayer player) {
|
public boolean canBuild(LocalPlayer player) {
|
||||||
checkNotNull(player);
|
checkNotNull(player);
|
||||||
return test(flagValueCalculator.queryPermission(player, DefaultFlag.BUILD));
|
return test(flagValueCalculator.queryState(player, DefaultFlag.BUILD));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether the given player is permitted to modify or interact with
|
* Test whether the given flags evaluate to {@code ALLOW}, implicitly also
|
||||||
* blocks. Additional flags to be considered can be provided. The
|
* considering the {@link DefaultFlag#BUILD} flag.
|
||||||
* {@code BUILD} flag is already included in the list of flags considered.
|
*
|
||||||
|
* <p>This method is equivalent to calling
|
||||||
|
* {@link #testState(LocalPlayer, StateFlag...)} with {@code flags} plus
|
||||||
|
* the {@code BUILD} flag.</p>
|
||||||
*
|
*
|
||||||
* @param player the player
|
* @param player the player
|
||||||
* @param flags zero or more flags
|
* @param flags zero or more flags
|
||||||
* @return true if permission is granted
|
* @return true if permission is granted
|
||||||
|
* @see #queryState(LocalPlayer, StateFlag...)
|
||||||
*/
|
*/
|
||||||
public boolean testBuild(LocalPlayer player, StateFlag... flags) {
|
public boolean testBuild(LocalPlayer player, StateFlag... flags) {
|
||||||
return test(flagValueCalculator.queryPermission(player, ObjectArrays.concat(flags, DefaultFlag.BUILD)));
|
checkNotNull(player);
|
||||||
|
return test(flagValueCalculator.queryState(player, ObjectArrays.concat(flags, DefaultFlag.BUILD)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the effective value for a list of state flags. The rules of
|
* 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>
|
||||||
|
*
|
||||||
|
* @param player an optional player, which would be used to determine the region groups that apply
|
||||||
|
* @param flags a list of flags to check
|
||||||
|
* @return true if the result was {@code ALLOW}
|
||||||
|
* @see #queryState(LocalPlayer, StateFlag...)
|
||||||
|
*/
|
||||||
|
public boolean testState(@Nullable LocalPlayer player, StateFlag... flags) {
|
||||||
|
return test(flagValueCalculator.queryState(player, 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},
|
* states is observed here; that is, {@code DENY} overrides {@code ALLOW},
|
||||||
* and {@code ALLOW} overrides {@code NONE}.
|
* and {@code ALLOW} overrides {@code NONE}. One flag may override another.
|
||||||
*
|
*
|
||||||
* <p>This method does <strong>not</strong> properly process build
|
* <p>{@code player} can be non-null to satisfy region group requirements,
|
||||||
* permissions. Instead, use {@link #testBuild(LocalPlayer, StateFlag...)}
|
* otherwise it will be assumed that the caller that is not a member of any
|
||||||
* for that purpose. This method is ideal for testing non-build related
|
* regions. (Flags on a region can be changed so that they only apply
|
||||||
* state flags (although a rarity), an example of which would be whether
|
* to certain users.) The player argument is required if the
|
||||||
* to play a song to players that enter an area.</p>
|
* {@link DefaultFlag#BUILD} flag is in the list of flags.</p>
|
||||||
*
|
|
||||||
* <p>A player can be provided that is used to determine whether the value
|
|
||||||
* of a flag on a particular region should be used. For example, if a
|
|
||||||
* flag's region group is set to {@link RegionGroup#MEMBERS} and the given
|
|
||||||
* player is not a member, then the region would be skipped when
|
|
||||||
* querying that flag. If {@code null} is provided for the player, then
|
|
||||||
* only flags that use {@link RegionGroup#ALL},
|
|
||||||
* {@link RegionGroup#NON_MEMBERS}, etc. will apply.</p>
|
|
||||||
*
|
|
||||||
* <p>This method does <strong>not</strong> use a {@link StateFlag}'s
|
|
||||||
* default value ({@link StateFlag#getDefault()}).</p>
|
|
||||||
*
|
*
|
||||||
* @param player an optional player, which would be used to determine the region groups that apply
|
* @param player an optional player, which would be used to determine the region groups that apply
|
||||||
* @param flags a list of flags to check
|
* @param flags a list of flags to check
|
||||||
@ -144,51 +157,23 @@ public State queryState(@Nullable LocalPlayer player, StateFlag... flags) {
|
|||||||
return flagValueCalculator.queryState(player, flags);
|
return flagValueCalculator.queryState(player, 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}.
|
|
||||||
*
|
|
||||||
* <p>This method is the same as
|
|
||||||
* {@link #queryState(LocalPlayer, StateFlag...)} except that it returns
|
|
||||||
* a boolean when the return value is {@code ALLOW}.</p>
|
|
||||||
*
|
|
||||||
* @param player an optional player, which would be used to determine the region groups that apply
|
|
||||||
* @param flags a list of flags to check
|
|
||||||
* @return true if the result was {@code ALLOW}
|
|
||||||
*/
|
|
||||||
public boolean testState(@Nullable LocalPlayer player, StateFlag... flags) {
|
|
||||||
return test(flagValueCalculator.queryState(player, flags));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the effective value for a flag. If there are multiple values
|
* Get the effective value for a flag. If there are multiple values
|
||||||
* (for example, if there are multiple regions with the same priority
|
* (for example, multiple overlapping regions with
|
||||||
* but with different farewell messages set, there would be multiple
|
* the same priority may have the same flag set), then the selected
|
||||||
* completing values), then the selected (or "winning") value will depend
|
* (or "winning") value will depend on the flag type.
|
||||||
* on the flag type.
|
|
||||||
*
|
*
|
||||||
* <p>Only some flag types actually have a strategy for picking the
|
* <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
|
* "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
|
* returned is undefined (it could be any value). As of writing, the only
|
||||||
* type of flag that can consistently return the same 'best' value is
|
* type of flag that actually has a strategy for picking a value is the
|
||||||
* {@link StateFlag}.</p>
|
* {@link StateFlag}.</p>
|
||||||
*
|
*
|
||||||
* <p>This method does <strong>not</strong> properly process build
|
* <p>{@code player} can be non-null to satisfy region group requirements,
|
||||||
* permissions. Instead, use {@link #testBuild(LocalPlayer, StateFlag...)}
|
* otherwise it will be assumed that the caller that is not a member of any
|
||||||
* for that purpose.</p>
|
* regions. (Flags on a region can be changed so that they only apply
|
||||||
*
|
* to certain users.) The player argument is required if the
|
||||||
* <p>A player can be provided that is used to determine whether the value
|
* {@link DefaultFlag#BUILD} flag is the flag being queried.</p>
|
||||||
* of a flag on a particular region should be used. For example, if a
|
|
||||||
* flag's region group is set to {@link RegionGroup#MEMBERS} and the given
|
|
||||||
* player is not a member, then the region would be skipped when
|
|
||||||
* querying that flag. If {@code null} is provided for the player, then
|
|
||||||
* only flags that use {@link RegionGroup#ALL},
|
|
||||||
* {@link RegionGroup#NON_MEMBERS}, etc. will apply.</p>
|
|
||||||
*
|
|
||||||
* <p>This method does <strong>not</strong> use a {@link StateFlag}'s
|
|
||||||
* default value ({@link StateFlag#getDefault()}) if the provided flag is
|
|
||||||
* a {@code StateFlag}.</p>
|
|
||||||
*
|
*
|
||||||
* @param player an optional player, which would be used to determine the region group to apply
|
* @param player an optional player, which would be used to determine the region group to apply
|
||||||
* @param flag the flag
|
* @param flag the flag
|
||||||
@ -204,21 +189,11 @@ public <V> V queryValue(@Nullable LocalPlayer player, Flag<V> flag) {
|
|||||||
* values. It is up to the caller to determine which value, if any,
|
* values. It is up to the caller to determine which value, if any,
|
||||||
* from the collection will be used.
|
* from the collection will be used.
|
||||||
*
|
*
|
||||||
* <p>This method does <strong>not</strong> properly process build
|
* <p>{@code player} can be non-null to satisfy region group requirements,
|
||||||
* permissions. Instead, use {@link #testBuild(LocalPlayer, StateFlag...)}
|
* otherwise it will be assumed that the caller that is not a member of any
|
||||||
* for that purpose.</p>
|
* regions. (Flags on a region can be changed so that they only apply
|
||||||
*
|
* to certain users.) The player argument is required if the
|
||||||
* <p>A player can be provided that is used to determine whether the value
|
* {@link DefaultFlag#BUILD} flag is the flag being queried.</p>
|
||||||
* of a flag on a particular region should be used. For example, if a
|
|
||||||
* flag's region group is set to {@link RegionGroup#MEMBERS} and the given
|
|
||||||
* player is not a member, then the region would be skipped when
|
|
||||||
* querying that flag. If {@code null} is provided for the player, then
|
|
||||||
* only flags that use {@link RegionGroup#ALL},
|
|
||||||
* {@link RegionGroup#NON_MEMBERS}, etc. will apply.</p>
|
|
||||||
*
|
|
||||||
* <p>This method does <strong>not</strong> include a {@link StateFlag}'s
|
|
||||||
* default value ({@link StateFlag#getDefault()}) if the provided flag is
|
|
||||||
* a {@code StateFlag}.</p>
|
|
||||||
*
|
*
|
||||||
* @param player an optional player, which would be used to determine the region group to apply
|
* @param player an optional player, which would be used to determine the region group to apply
|
||||||
* @param flag the flag
|
* @param flag the flag
|
||||||
@ -249,12 +224,7 @@ public boolean canConstruct(LocalPlayer player) {
|
|||||||
* @param flag flag to check
|
* @param flag flag to check
|
||||||
* @return whether it is allowed
|
* @return whether it is allowed
|
||||||
* @throws IllegalArgumentException if the build flag is given
|
* @throws IllegalArgumentException if the build flag is given
|
||||||
* @deprecated Use {@link #queryState(LocalPlayer, StateFlag...)} instead, although
|
* @deprecated use {@link #queryState(LocalPlayer, StateFlag...)} instead
|
||||||
* be aware that the default value of the flag is <strong>not</strong>
|
|
||||||
* considered in that method. Default values, however, are being
|
|
||||||
* deprecated (except when using it in the context of testing
|
|
||||||
* build permissions) because they have historically been applied
|
|
||||||
* very inconsistently.
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean allows(StateFlag flag) {
|
public boolean allows(StateFlag flag) {
|
||||||
@ -274,12 +244,7 @@ public boolean allows(StateFlag flag) {
|
|||||||
* @param player player (used by some flags)
|
* @param player player (used by some flags)
|
||||||
* @return whether the state is allows for it
|
* @return whether the state is allows for it
|
||||||
* @throws IllegalArgumentException if the build flag is given
|
* @throws IllegalArgumentException if the build flag is given
|
||||||
* @deprecated Use {@link #queryState(LocalPlayer, StateFlag...)} instead, although
|
* @deprecated use {@link #queryState(LocalPlayer, StateFlag...)} instead
|
||||||
* be aware that the default value of the flag is <strong>not</strong>
|
|
||||||
* considered in that method. Default values, however, are being
|
|
||||||
* deprecated (except when using it in the context of testing
|
|
||||||
* build permissions) because they have historically been applied
|
|
||||||
* very inconsistently.
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean allows(StateFlag flag, @Nullable LocalPlayer player) {
|
public boolean allows(StateFlag flag, @Nullable LocalPlayer player) {
|
||||||
|
@ -169,75 +169,12 @@ public Result getMembership(LocalPlayer player) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test whether the given player is permitted to place, break, or
|
|
||||||
* modify any block, entity, or other object. A list of flags is to be
|
|
||||||
* provided (one of which should probably be {@link DefaultFlag#BUILD})
|
|
||||||
* so that the calculation can consider all of those flags.
|
|
||||||
*
|
|
||||||
* <p>For example, if we are checking for the ability to interact
|
|
||||||
* with a chest, we would want to give permission if (1) the player is
|
|
||||||
* a member of the region, (2) the {@code build} flag is set to
|
|
||||||
* {@code ALLOW}, or (3) the {@code chest-access} flag is set to
|
|
||||||
* {@code ALLOW}. However, if any of the two flags are set
|
|
||||||
* to {@code DENY}, that must override everything else and deny access.</p>
|
|
||||||
*
|
|
||||||
* <p>This method handles that example perfectly. To use the method for
|
|
||||||
* the example, the call would look like this:</p>
|
|
||||||
*
|
|
||||||
* <pre>queryPermission(player, DefaultFlag.BUILD, DefaultFlag.CHEST_ACCESS)</pre>
|
|
||||||
*
|
|
||||||
* @param player the player
|
|
||||||
* @param flags zero or more flags
|
|
||||||
* @return true if permission is granted
|
|
||||||
*/
|
|
||||||
public State queryPermission(LocalPlayer player, StateFlag... flags) {
|
|
||||||
checkNotNull(player);
|
|
||||||
checkNotNull(flags);
|
|
||||||
|
|
||||||
// Legacy behavior dictates that the global region is really a
|
|
||||||
// "wilderness" region. It has no effect when there are one or more
|
|
||||||
// regions without the PASSTHROUGH flag set.
|
|
||||||
//
|
|
||||||
// In addition, the global region can never override any PASSTHROUGH
|
|
||||||
// region.
|
|
||||||
//
|
|
||||||
// Lastly, if the global region has members, then permission will
|
|
||||||
// be denied by default except to those members that are a part of
|
|
||||||
// the global region, turning the global region into a region itself
|
|
||||||
// that covers the entire world. Unfortunately, this is really a hack
|
|
||||||
// and we support it for legacy reasons.
|
|
||||||
|
|
||||||
switch (getMembership(player)) {
|
|
||||||
case SUCCESS:
|
|
||||||
return StateFlag.combine(queryState(player, flags), State.ALLOW);
|
|
||||||
case FAIL:
|
|
||||||
return queryState(player, flags);
|
|
||||||
case NO_REGIONS:
|
|
||||||
default:
|
|
||||||
State fallback = null;
|
|
||||||
for (StateFlag flag : flags) {
|
|
||||||
if (flag.getDefault()) {
|
|
||||||
fallback = State.ALLOW;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return StateFlag.combine(queryState(player, flags), fallback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the effective value for a list of state flags. The rules of
|
* Get the effective value for a list of state flags. The rules of
|
||||||
* states is observed here; that is, {@code DENY} overrides {@code ALLOW},
|
* states is observed here; that is, {@code DENY} overrides {@code ALLOW},
|
||||||
* and {@code ALLOW} overrides {@code NONE}.
|
* and {@code ALLOW} overrides {@code NONE}.
|
||||||
*
|
*
|
||||||
* <p>This method does <strong>not</strong> properly process build
|
|
||||||
* permissions. Instead, use {@link #queryPermission(LocalPlayer, StateFlag...)}
|
|
||||||
* for that purpose. This method is ideal for testing non-build related
|
|
||||||
* state flags (although a rarity), an example of which would be whether
|
|
||||||
* to play a song to players that enter an area.</p>
|
|
||||||
*
|
|
||||||
* <p>A player can be provided that is used to determine whether the value
|
* <p>A player can be provided that is used to determine whether the value
|
||||||
* of a flag on a particular region should be used. For example, if a
|
* of a flag on a particular region should be used. For example, if a
|
||||||
* flag's region group is set to {@link RegionGroup#MEMBERS} and the given
|
* flag's region group is set to {@link RegionGroup#MEMBERS} and the given
|
||||||
@ -277,10 +214,6 @@ public State queryState(@Nullable LocalPlayer player, StateFlag... flags) {
|
|||||||
* type of flag that can consistently return the same 'best' value is
|
* type of flag that can consistently return the same 'best' value is
|
||||||
* {@link StateFlag}.</p>
|
* {@link StateFlag}.</p>
|
||||||
*
|
*
|
||||||
* <p>This method does <strong>not</strong> properly process build
|
|
||||||
* permissions. Instead, use {@link #queryPermission(LocalPlayer, StateFlag...)}
|
|
||||||
* for that purpose.</p>
|
|
||||||
*
|
|
||||||
* <p>A player can be provided that is used to determine whether the value
|
* <p>A player can be provided that is used to determine whether the value
|
||||||
* of a flag on a particular region should be used. For example, if a
|
* of a flag on a particular region should be used. For example, if a
|
||||||
* flag's region group is set to {@link RegionGroup#MEMBERS} and the given
|
* flag's region group is set to {@link RegionGroup#MEMBERS} and the given
|
||||||
@ -304,10 +237,6 @@ public <V> V queryValue(@Nullable LocalPlayer player, Flag<V> flag) {
|
|||||||
* values. It is up to the caller to determine which value, if any,
|
* values. It is up to the caller to determine which value, if any,
|
||||||
* from the collection will be used.
|
* from the collection will be used.
|
||||||
*
|
*
|
||||||
* <p>This method does <strong>not</strong> properly process build
|
|
||||||
* permissions. Instead, use {@link #queryPermission(LocalPlayer, StateFlag...)}
|
|
||||||
* for that purpose.</p>
|
|
||||||
*
|
|
||||||
* <p>A player can be provided that is used to determine whether the value
|
* <p>A player can be provided that is used to determine whether the value
|
||||||
* of a flag on a particular region should be used. For example, if a
|
* of a flag on a particular region should be used. For example, if a
|
||||||
* flag's region group is set to {@link RegionGroup#MEMBERS} and the given
|
* flag's region group is set to {@link RegionGroup#MEMBERS} and the given
|
||||||
@ -320,6 +249,7 @@ public <V> V queryValue(@Nullable LocalPlayer player, Flag<V> flag) {
|
|||||||
* @param flag the flag
|
* @param flag the flag
|
||||||
* @return a collection of values
|
* @return a collection of values
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <V> Collection<V> queryAllValues(@Nullable LocalPlayer player, Flag<V> flag) {
|
public <V> Collection<V> queryAllValues(@Nullable LocalPlayer player, Flag<V> flag) {
|
||||||
checkNotNull(flag);
|
checkNotNull(flag);
|
||||||
|
|
||||||
@ -383,6 +313,28 @@ public <V> Collection<V> queryAllValues(@Nullable LocalPlayer player, Flag<V> fl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flag == DefaultFlag.BUILD && consideredValues.isEmpty()) {
|
||||||
|
if (player == null) {
|
||||||
|
throw new NullPointerException("The BUILD flag is handled in a special fashion and requires a non-null player parameter");
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (getMembership(player)) {
|
||||||
|
case FAIL:
|
||||||
|
return ImmutableList.of();
|
||||||
|
case SUCCESS:
|
||||||
|
return (Collection<V>) ImmutableList.of(State.ALLOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (consideredValues.isEmpty()) {
|
||||||
|
if (flag instanceof StateFlag) {
|
||||||
|
//noinspection unchecked
|
||||||
|
return (Collection<V>) (((StateFlag) flag).getDefault()
|
||||||
|
? ImmutableList.of(State.ALLOW)
|
||||||
|
: ImmutableList.of());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return consideredValues.values();
|
return consideredValues.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,27 +29,32 @@
|
|||||||
public final class DefaultFlag {
|
public final class DefaultFlag {
|
||||||
|
|
||||||
public static final StateFlag PASSTHROUGH = new StateFlag("passthrough", false);
|
public static final StateFlag PASSTHROUGH = new StateFlag("passthrough", false);
|
||||||
public static final StateFlag BUILD = new StateFlag("build", true);
|
|
||||||
public static final RegionGroupFlag CONSTRUCT = new RegionGroupFlag("construct", RegionGroup.MEMBERS);
|
public static final RegionGroupFlag CONSTRUCT = new RegionGroupFlag("construct", RegionGroup.MEMBERS);
|
||||||
public static final StateFlag PVP = new StateFlag("pvp", true);
|
|
||||||
|
// This flag is unlike the others. It forces the checking of region
|
||||||
|
// membership.
|
||||||
|
public static final StateFlag BUILD = new StateFlag("build", true);
|
||||||
|
|
||||||
|
public static final StateFlag USE = new StateFlag("use", false);
|
||||||
|
public static final StateFlag PVP = new StateFlag("pvp", false);
|
||||||
|
public static final StateFlag SLEEP = new StateFlag("sleep", false);
|
||||||
|
public static final StateFlag TNT = new StateFlag("tnt", false);
|
||||||
|
public static final StateFlag CHEST_ACCESS = new StateFlag("chest-access", false);
|
||||||
|
public static final StateFlag PLACE_VEHICLE = new StateFlag("vehicle-place", false);
|
||||||
|
public static final StateFlag DESTROY_VEHICLE = new StateFlag("vehicle-destroy", false);
|
||||||
|
public static final StateFlag LIGHTER = new StateFlag("lighter", false);
|
||||||
|
|
||||||
public static final StateFlag MOB_DAMAGE = new StateFlag("mob-damage", true);
|
public static final StateFlag MOB_DAMAGE = new StateFlag("mob-damage", true);
|
||||||
public static final StateFlag MOB_SPAWNING = new StateFlag("mob-spawning", true);
|
public static final StateFlag MOB_SPAWNING = new StateFlag("mob-spawning", true);
|
||||||
public static final StateFlag CREEPER_EXPLOSION = new StateFlag("creeper-explosion", true);
|
public static final StateFlag CREEPER_EXPLOSION = new StateFlag("creeper-explosion", true);
|
||||||
public static final StateFlag ENDERDRAGON_BLOCK_DAMAGE = new StateFlag("enderdragon-block-damage", true);
|
public static final StateFlag ENDERDRAGON_BLOCK_DAMAGE = new StateFlag("enderdragon-block-damage", true);
|
||||||
public static final StateFlag GHAST_FIREBALL = new StateFlag("ghast-fireball", true);
|
public static final StateFlag GHAST_FIREBALL = new StateFlag("ghast-fireball", true);
|
||||||
public static final StateFlag OTHER_EXPLOSION = new StateFlag("other-explosion", true);
|
public static final StateFlag OTHER_EXPLOSION = new StateFlag("other-explosion", true);
|
||||||
public static final StateFlag SLEEP = new StateFlag("sleep", true);
|
|
||||||
public static final StateFlag TNT = new StateFlag("tnt", true);
|
|
||||||
public static final StateFlag LIGHTER = new StateFlag("lighter", true);
|
|
||||||
public static final StateFlag FIRE_SPREAD = new StateFlag("fire-spread", true);
|
public static final StateFlag FIRE_SPREAD = new StateFlag("fire-spread", true);
|
||||||
public static final StateFlag LAVA_FIRE = new StateFlag("lava-fire", true);
|
public static final StateFlag LAVA_FIRE = new StateFlag("lava-fire", true);
|
||||||
public static final StateFlag LIGHTNING = new StateFlag("lightning", true);
|
public static final StateFlag LIGHTNING = new StateFlag("lightning", true);
|
||||||
public static final StateFlag CHEST_ACCESS = new StateFlag("chest-access", true);
|
|
||||||
public static final StateFlag WATER_FLOW = new StateFlag("water-flow", true);
|
public static final StateFlag WATER_FLOW = new StateFlag("water-flow", true);
|
||||||
public static final StateFlag LAVA_FLOW = new StateFlag("lava-flow", true);
|
public static final StateFlag LAVA_FLOW = new StateFlag("lava-flow", true);
|
||||||
public static final StateFlag USE = new StateFlag("use", true);
|
|
||||||
public static final StateFlag PLACE_VEHICLE = new StateFlag("vehicle-place", true);
|
|
||||||
public static final StateFlag DESTROY_VEHICLE = new StateFlag("vehicle-destroy", true);
|
|
||||||
public static final StateFlag PISTONS = new StateFlag("pistons", true);
|
public static final StateFlag PISTONS = new StateFlag("pistons", true);
|
||||||
public static final StateFlag SNOW_FALL = new StateFlag("snow-fall", true);
|
public static final StateFlag SNOW_FALL = new StateFlag("snow-fall", true);
|
||||||
public static final StateFlag SNOW_MELT = new StateFlag("snow-melt", true);
|
public static final StateFlag SNOW_MELT = new StateFlag("snow-melt", true);
|
||||||
@ -73,6 +78,7 @@ public final class DefaultFlag {
|
|||||||
public static final StateFlag ENTITY_PAINTING_DESTROY = new StateFlag("entity-painting-destroy", true);
|
public static final StateFlag ENTITY_PAINTING_DESTROY = new StateFlag("entity-painting-destroy", true);
|
||||||
public static final StateFlag ENTITY_ITEM_FRAME_DESTROY = new StateFlag("entity-item-frame-destroy", true);
|
public static final StateFlag ENTITY_ITEM_FRAME_DESTROY = new StateFlag("entity-item-frame-destroy", true);
|
||||||
public static final StateFlag POTION_SPLASH = new StateFlag("potion-splash", true);
|
public static final StateFlag POTION_SPLASH = new StateFlag("potion-splash", true);
|
||||||
|
|
||||||
public static final StringFlag GREET_MESSAGE = new StringFlag("greeting");
|
public static final StringFlag GREET_MESSAGE = new StringFlag("greeting");
|
||||||
public static final StringFlag FAREWELL_MESSAGE = new StringFlag("farewell");
|
public static final StringFlag FAREWELL_MESSAGE = new StringFlag("farewell");
|
||||||
public static final BooleanFlag NOTIFY_ENTER = new BooleanFlag("notify-enter");
|
public static final BooleanFlag NOTIFY_ENTER = new BooleanFlag("notify-enter");
|
||||||
@ -98,20 +104,20 @@ public final class DefaultFlag {
|
|||||||
public static final SetFlag<String> ALLOWED_CMDS = new SetFlag<String>("allowed-cmds", new CommandStringFlag(null));
|
public static final SetFlag<String> ALLOWED_CMDS = new SetFlag<String>("allowed-cmds", new CommandStringFlag(null));
|
||||||
|
|
||||||
public static final Flag<?>[] flagsList = new Flag<?>[] {
|
public static final Flag<?>[] flagsList = new Flag<?>[] {
|
||||||
PASSTHROUGH, BUILD, CONSTRUCT, PVP, CHEST_ACCESS, PISTONS,
|
PASSTHROUGH, BUILD, CONSTRUCT, PVP, CHEST_ACCESS, PISTONS,
|
||||||
TNT, LIGHTER, USE, PLACE_VEHICLE, DESTROY_VEHICLE, SLEEP,
|
TNT, LIGHTER, USE, PLACE_VEHICLE, DESTROY_VEHICLE, SLEEP,
|
||||||
MOB_DAMAGE, MOB_SPAWNING, DENY_SPAWN, INVINCIBILITY, EXP_DROPS,
|
MOB_DAMAGE, MOB_SPAWNING, DENY_SPAWN, INVINCIBILITY, EXP_DROPS,
|
||||||
CREEPER_EXPLOSION, OTHER_EXPLOSION, ENDERDRAGON_BLOCK_DAMAGE, GHAST_FIREBALL, ENDER_BUILD,
|
CREEPER_EXPLOSION, OTHER_EXPLOSION, ENDERDRAGON_BLOCK_DAMAGE, GHAST_FIREBALL, ENDER_BUILD,
|
||||||
GREET_MESSAGE, FAREWELL_MESSAGE, NOTIFY_ENTER, NOTIFY_LEAVE,
|
GREET_MESSAGE, FAREWELL_MESSAGE, NOTIFY_ENTER, NOTIFY_LEAVE,
|
||||||
EXIT, ENTRY, LIGHTNING, ENTITY_PAINTING_DESTROY, ENDERPEARL,
|
EXIT, ENTRY, LIGHTNING, ENTITY_PAINTING_DESTROY, ENDERPEARL,
|
||||||
ENTITY_ITEM_FRAME_DESTROY, ITEM_DROP, /*MAX_PLAYERS, MAX_PLAYERS_MESSAGE,*/
|
ENTITY_ITEM_FRAME_DESTROY, ITEM_DROP, /*MAX_PLAYERS, MAX_PLAYERS_MESSAGE,*/
|
||||||
HEAL_AMOUNT, HEAL_DELAY, MIN_HEAL, MAX_HEAL,
|
HEAL_AMOUNT, HEAL_DELAY, MIN_HEAL, MAX_HEAL,
|
||||||
FEED_DELAY, FEED_AMOUNT, MIN_FOOD, MAX_FOOD,
|
FEED_DELAY, FEED_AMOUNT, MIN_FOOD, MAX_FOOD,
|
||||||
SNOW_FALL, SNOW_MELT, ICE_FORM, ICE_MELT, SOIL_DRY, GAME_MODE,
|
SNOW_FALL, SNOW_MELT, ICE_FORM, ICE_MELT, SOIL_DRY, GAME_MODE,
|
||||||
MUSHROOMS, LEAF_DECAY, GRASS_SPREAD, MYCELIUM_SPREAD, VINE_GROWTH,
|
MUSHROOMS, LEAF_DECAY, GRASS_SPREAD, MYCELIUM_SPREAD, VINE_GROWTH,
|
||||||
SEND_CHAT, RECEIVE_CHAT, FIRE_SPREAD, LAVA_FIRE, LAVA_FLOW, WATER_FLOW,
|
SEND_CHAT, RECEIVE_CHAT, FIRE_SPREAD, LAVA_FIRE, LAVA_FLOW, WATER_FLOW,
|
||||||
TELE_LOC, SPAWN_LOC, POTION_SPLASH,
|
TELE_LOC, SPAWN_LOC, POTION_SPLASH,
|
||||||
BLOCKED_CMDS, ALLOWED_CMDS, PRICE, BUYABLE, ENABLE_SHOP
|
BLOCKED_CMDS, ALLOWED_CMDS, PRICE, BUYABLE, ENABLE_SHOP
|
||||||
};
|
};
|
||||||
|
|
||||||
private DefaultFlag() {
|
private DefaultFlag() {
|
||||||
|
@ -73,24 +73,25 @@ public void testWildernessBuildWithRegion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFlags() {
|
public void testWildernessFlags() {
|
||||||
MockApplicableRegionSet mock = new MockApplicableRegionSet();
|
MockApplicableRegionSet mock = new MockApplicableRegionSet();
|
||||||
|
|
||||||
LocalPlayer player = mock.createPlayer();
|
LocalPlayer player = mock.createPlayer();
|
||||||
|
|
||||||
ApplicableRegionSet set = mock.getApplicableSet();
|
ApplicableRegionSet set = mock.getApplicableSet();
|
||||||
assertThat(set.testState(player, DefaultFlag.PVP), is(true));
|
|
||||||
assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true));
|
|
||||||
assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true));
|
assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true));
|
||||||
assertThat(set.testState(player, DefaultFlag.ENTRY), is(true));
|
assertThat(set.testState(player, DefaultFlag.ENTRY), is(true));
|
||||||
assertThat(set.testState(player, DefaultFlag.EXIT), is(true));
|
assertThat(set.testState(player, DefaultFlag.EXIT), is(true));
|
||||||
assertThat(set.testState(player, DefaultFlag.CHEST_ACCESS), is(true));
|
|
||||||
assertThat(set.testState(player, DefaultFlag.SLEEP), is(true));
|
|
||||||
assertThat(set.testState(player, DefaultFlag.TNT), is(true));
|
|
||||||
assertThat(set.testState(player, DefaultFlag.LEAF_DECAY), is(true));
|
assertThat(set.testState(player, DefaultFlag.LEAF_DECAY), is(true));
|
||||||
assertThat(set.testState(player, DefaultFlag.RECEIVE_CHAT), is(true));
|
assertThat(set.testState(player, DefaultFlag.RECEIVE_CHAT), is(true));
|
||||||
assertThat(set.testState(player, DefaultFlag.SEND_CHAT), is(true));
|
assertThat(set.testState(player, DefaultFlag.SEND_CHAT), is(true));
|
||||||
assertThat(set.testState(player, DefaultFlag.INVINCIBILITY), is(false));
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -102,18 +103,19 @@ public void testWildernessFlagsWithGlobalRegion() {
|
|||||||
ProtectedRegion global = mock.global();
|
ProtectedRegion global = mock.global();
|
||||||
|
|
||||||
ApplicableRegionSet set = mock.getApplicableSet();
|
ApplicableRegionSet set = mock.getApplicableSet();
|
||||||
assertThat(set.testState(player, DefaultFlag.PVP), is(true));
|
|
||||||
assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true));
|
|
||||||
assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true));
|
assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true));
|
||||||
assertThat(set.testState(player, DefaultFlag.ENTRY), is(true));
|
assertThat(set.testState(player, DefaultFlag.ENTRY), is(true));
|
||||||
assertThat(set.testState(player, DefaultFlag.EXIT), is(true));
|
assertThat(set.testState(player, DefaultFlag.EXIT), is(true));
|
||||||
assertThat(set.testState(player, DefaultFlag.CHEST_ACCESS), is(true));
|
|
||||||
assertThat(set.testState(player, DefaultFlag.SLEEP), is(true));
|
|
||||||
assertThat(set.testState(player, DefaultFlag.TNT), is(true));
|
|
||||||
assertThat(set.testState(player, DefaultFlag.LEAF_DECAY), is(true));
|
assertThat(set.testState(player, DefaultFlag.LEAF_DECAY), is(true));
|
||||||
assertThat(set.testState(player, DefaultFlag.RECEIVE_CHAT), is(true));
|
assertThat(set.testState(player, DefaultFlag.RECEIVE_CHAT), is(true));
|
||||||
assertThat(set.testState(player, DefaultFlag.SEND_CHAT), is(true));
|
assertThat(set.testState(player, DefaultFlag.SEND_CHAT), is(true));
|
||||||
assertThat(set.testState(player, DefaultFlag.INVINCIBILITY), is(false));
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -127,18 +129,32 @@ public void testFlagsWithRegion() {
|
|||||||
region.getMembers().addPlayer(member);
|
region.getMembers().addPlayer(member);
|
||||||
|
|
||||||
ApplicableRegionSet set = mock.getApplicableSet();
|
ApplicableRegionSet set = mock.getApplicableSet();
|
||||||
|
|
||||||
|
assertThat(set.testState(member, DefaultFlag.MOB_DAMAGE), is(true));
|
||||||
assertThat(set.testState(member, DefaultFlag.ENTRY), is(true));
|
assertThat(set.testState(member, DefaultFlag.ENTRY), is(true));
|
||||||
assertThat(set.testState(member, DefaultFlag.EXIT), is(true));
|
assertThat(set.testState(member, DefaultFlag.EXIT), is(true));
|
||||||
assertThat(set.testState(member, DefaultFlag.LEAF_DECAY), is(true));
|
assertThat(set.testState(member, DefaultFlag.LEAF_DECAY), is(true));
|
||||||
assertThat(set.testState(member, DefaultFlag.RECEIVE_CHAT), is(true));
|
assertThat(set.testState(member, DefaultFlag.RECEIVE_CHAT), is(true));
|
||||||
assertThat(set.testState(member, DefaultFlag.SEND_CHAT), is(true));
|
assertThat(set.testState(member, DefaultFlag.SEND_CHAT), is(true));
|
||||||
assertThat(set.testState(member, DefaultFlag.INVINCIBILITY), is(false));
|
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(nonMember, DefaultFlag.MOB_DAMAGE), is(true));
|
||||||
assertThat(set.testState(nonMember, DefaultFlag.ENTRY), is(true));
|
assertThat(set.testState(nonMember, DefaultFlag.ENTRY), is(true));
|
||||||
assertThat(set.testState(nonMember, DefaultFlag.EXIT), is(true));
|
assertThat(set.testState(nonMember, DefaultFlag.EXIT), is(true));
|
||||||
assertThat(set.testState(nonMember, DefaultFlag.LEAF_DECAY), is(true));
|
assertThat(set.testState(nonMember, DefaultFlag.LEAF_DECAY), is(true));
|
||||||
assertThat(set.testState(nonMember, DefaultFlag.RECEIVE_CHAT), is(true));
|
assertThat(set.testState(nonMember, DefaultFlag.RECEIVE_CHAT), is(true));
|
||||||
assertThat(set.testState(nonMember, DefaultFlag.SEND_CHAT), is(true));
|
assertThat(set.testState(nonMember, DefaultFlag.SEND_CHAT), is(true));
|
||||||
assertThat(set.testState(nonMember, DefaultFlag.INVINCIBILITY), is(false));
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user