public abstract class Flag<T> extends Object
| Constructor and Description |
|---|
Flag(String name)
Create a new flag with
RegionGroup.ALL as the default group. |
Flag(String name,
RegionGroup defaultGroup)
Create a new flag.
|
| Modifier and Type | Method and Description |
|---|---|
T |
chooseValue(Collection<T> values) |
T |
getDefault()
Get the default value.
|
String |
getName()
Get the name of the flag.
|
RegionGroupFlag |
getRegionGroupFlag()
Get the region group flag.
|
boolean |
hasConflictStrategy()
Whether the flag can take a list of values and choose a "best one."
|
boolean |
implicitlySetWithMembership()
Whether the flag implicitly has a value set as long as
DefaultFlag.PASSTHROUGH is not set. |
abstract Object |
marshal(T o)
Convert the value stored for this flag into a type that can be
serialized into YAML.
|
abstract T |
parseInput(WorldGuardPlugin plugin,
org.bukkit.command.CommandSender sender,
String input)
Parse a given input to coerce it to a type compatible with the flag.
|
boolean |
requiresSubject()
Whether the flag requires that a subject is specified in
FlagValueCalculator. |
String |
toString() |
abstract T |
unmarshal(Object o)
Convert a raw type that was loaded (from a YAML file, for example)
into the type that this flag uses.
|
boolean |
usesMembershipAsDefault()
Whether, if the flag is not set at all, the value should be derived
from membership.
|
public Flag(String name, @Nullable RegionGroup defaultGroup)
name - The name of the flagdefaultGroup - The default grouppublic Flag(String name)
RegionGroup.ALL as the default group.name - The name of the flagpublic String getName()
@Nullable public T getDefault()
null may be returned@Nullable public T chooseValue(Collection<T> values)
public boolean hasConflictStrategy()
This 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.
public boolean implicitlySetWithMembership()
DefaultFlag.PASSTHROUGH is not set.
This value is only changed, at least in WorldGuard, for the
DefaultFlag.BUILD flag.
public boolean usesMembershipAsDefault()
This value is only changed, at least in WorldGuard, for the
DefaultFlag.BUILD flag.
public boolean requiresSubject()
FlagValueCalculator.
This value is only changed, at least in WorldGuard, for the
DefaultFlag.BUILD flag.
public RegionGroupFlag getRegionGroupFlag()
Every group has a region group flag except for region group flags themselves.
public abstract T parseInput(WorldGuardPlugin plugin, org.bukkit.command.CommandSender sender, String input) throws InvalidFlagFormat
plugin - The pluginsender - The senderinput - THe inputInvalidFlagFormat - Raised if the input is invalidpublic abstract T unmarshal(@Nullable Object o)
o - The objectpublic abstract Object marshal(T o)
o - The objectCopyright © 2015. All Rights Reserved.