public class StateFlag extends Flag<StateFlag.State>
| Modifier and Type | Class and Description |
|---|---|
static class |
StateFlag.State |
| Constructor and Description |
|---|
StateFlag(java.lang.String name,
boolean def) |
StateFlag(java.lang.String name,
boolean def,
RegionGroup defaultGroup) |
| Modifier and Type | Method and Description |
|---|---|
static StateFlag.State |
allowOrNone(boolean flag)
Turn a boolean into either
NONE (null) or ALLOW if
the boolean is false or true, respectively. |
StateFlag.State |
chooseValue(java.util.Collection<StateFlag.State> values)
Given a list of values, choose the best one.
|
static StateFlag.State |
combine(java.util.Collection<StateFlag.State> states)
Combine states, letting
DENY override ALLOW and
ALLOW override NONE (or null). |
static StateFlag.State |
combine(StateFlag.State... states)
Combine states, letting
DENY override ALLOW and
ALLOW override NONE (or null). |
static StateFlag.State |
denyToNone(StateFlag.State state)
Turn
DENY into NONE (null). |
StateFlag.State |
getDefault()
Get the default value.
|
boolean |
hasConflictStrategy()
Whether the flag can take a list of values and choose a "best one."
|
java.lang.Object |
marshal(StateFlag.State o)
Convert the value stored for this flag into a type that can be
serialized into YAML.
|
StateFlag.State |
parseInput(FlagContext context)
Parse a given input to coerce it to a type compatible with the flag.
|
boolean |
preventsAllowOnGlobal()
Whether setting this flag to
StateFlag.State.ALLOW is prevented on
the global region. |
static boolean |
test(StateFlag.State... states)
Test whether at least one of the given states is
ALLOW
but none are set to DENY. |
StateFlag.State |
unmarshal(java.lang.Object o)
Convert a raw type that was loaded (from a YAML file, for example)
into the type that this flag uses.
|
getName, getRegionGroupFlag, implicitlySetWithMembership, isValidName, requiresSubject, toString, usesMembershipAsDefaultpublic StateFlag(java.lang.String name,
boolean def,
RegionGroup defaultGroup)
public StateFlag(java.lang.String name,
boolean def)
public StateFlag.State getDefault()
FlaggetDefault in class Flag<StateFlag.State>null may be returnedpublic boolean hasConflictStrategy()
FlagThis is the case with the StateFlag where DENY
overrides ALLOW, but most flags just return the
first result from a list.
This flag is primarily used to optimize flag lookup in
FlagValueCalculator.
hasConflictStrategy in class Flag<StateFlag.State>@Nullable public StateFlag.State chooseValue(java.util.Collection<StateFlag.State> values)
FlagIf there is no "best value" defined, then the first value should
be returned. The default implementation returns the first value. If
an implementation does have a strategy defined, then
Flag.hasConflictStrategy() should be overridden too.
chooseValue in class Flag<StateFlag.State>values - A collection of valuespublic boolean preventsAllowOnGlobal()
StateFlag.State.ALLOW is prevented on
the global region.
This value is only changed, at least in WorldGuard, for the
Flags.BUILD flag.
ALLOW is preventedpublic StateFlag.State parseInput(FlagContext context) throws InvalidFlagFormat
FlagparseInput in class Flag<StateFlag.State>context - the FlagContextInvalidFlagFormat - Raised if the input is invalidpublic StateFlag.State unmarshal(java.lang.Object o)
Flagunmarshal in class Flag<StateFlag.State>o - The objectpublic java.lang.Object marshal(StateFlag.State o)
Flagmarshal in class Flag<StateFlag.State>o - The objectpublic static boolean test(StateFlag.State... states)
ALLOW
but none are set to DENY.states - zero or more states@Nullable public static StateFlag.State combine(StateFlag.State... states)
DENY override ALLOW and
ALLOW override NONE (or null).states - zero or more states@Nullable public static StateFlag.State combine(java.util.Collection<StateFlag.State> states)
DENY override ALLOW and
ALLOW override NONE (or null).states - zero or more states@Nullable public static StateFlag.State allowOrNone(boolean flag)
NONE (null) or ALLOW if
the boolean is false or true, respectively.flag - a boolean value@Nullable public static StateFlag.State denyToNone(StateFlag.State state)
DENY into NONE (null).state - a state