Interface ApplicableRegionSet
- All Superinterfaces:
Iterable<ProtectedRegion>
- All Known Implementing Classes:
AbstractRegionSet
,FailedLoadRegionSet
,PermissiveRegionSet
,RegionResultSet
An instance of this can be created using the spatial query methods
available on RegionManager
.
-
Method Summary
Modifier and TypeMethodDescriptionGet an immutable set of regions that are included in this set.boolean
isMemberOfAll
(LocalPlayer player) Test whether a player is an owner or member of all regions in this set.boolean
isOwnerOfAll
(LocalPlayer player) Test whether a player is an owner of all regions in this set.boolean
Return whether this region set is a virtual set.<V> Collection
<V> queryAllValues
(RegionAssociable subject, Flag<V> flag) Get the effective values for a flag, returning a collection of all values.<V,
K> V queryMapValue
(RegionAssociable subject, MapFlag<K, V> flag, K key) Get the effective value for a key in aMapFlag
.<V,
K> V queryMapValue
(RegionAssociable subject, MapFlag<K, V> flag, K key, Flag<V> fallback) Get the effective value for a key in aMapFlag
.queryState
(RegionAssociable subject, StateFlag... flags) Get the (effective) value for a list of state flags.<V> V
queryValue
(RegionAssociable subject, Flag<V> flag) Get the effective value for a flag.int
size()
Get the number of regions that are included.boolean
testState
(RegionAssociable subject, StateFlag... flags) Test whether the (effective) value for a list of state flags equalsALLOW
.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
isVirtual
boolean isVirtual()Return whether this region set is a virtual set. A virtual set does not contain real results.A virtual result may be returned if region data failed to load or there was some special exception (i.e. the region bypass permission).
Be sure to check the value of this flag if an instance of this interface is being retrieved from RegionQuery as it may return an instance of
PermissiveRegionSet
orFailedLoadRegionSet
, among other possibilities.- Returns:
- true if loaded
- See Also:
-
testState
Test whether the (effective) value for a list of state flags equalsALLOW
.subject
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 subject argument is required if theFlags.BUILD
flag is in the list of flags.- Parameters:
subject
- an optional subject, which would be used to determine the region groups that applyflags
- a list of flags to check- Returns:
- true if the result was
ALLOW
- See Also:
-
queryState
Get the (effective) value for a list of state flags. The rules of states is observed here; that is,DENY
overridesALLOW
, andALLOW
overridesNONE
. One flag may override another.subject
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 subject argument is required if theFlags.BUILD
flag is in the list of flags.- Parameters:
subject
- an optional subject, which would be used to determine the region groups that applyflags
- a list of flags to check- Returns:
- a state
-
queryValue
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.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
StateFlag
.subject
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 subject argument is required if theFlags.BUILD
flag is the flag being queried.- Parameters:
subject
- an optional subject, which would be used to determine the region group to applyflag
- the flag- Returns:
- a value, which could be
null
-
queryMapValue
Get the effective value for a key in aMapFlag
. If there are multiple values (for example, if there are multiple regions with the same priority but with different farewell messages set, there would be multiple completing values), then the selected (or "winning") value will be undefined.A subject 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
RegionGroup.MEMBERS
and the given subject is not a member, then the region would be skipped when querying that flag. Ifnull
is provided for the subject, then only flags that useRegionGroup.ALL
,RegionGroup.NON_MEMBERS
, etc. will apply.- Parameters:
subject
- an optional subject, which would be used to determine the region group to applyflag
- the flag of typeMapFlag
key
- the key for the map flag- Returns:
- a value, which could be
null
-
queryMapValue
@Nullable <V,K> V queryMapValue(@Nullable RegionAssociable subject, MapFlag<K, V> flag, K key, @Nullable Flag<V> fallback) Get the effective value for a key in aMapFlag
. If there are multiple values (for example, if there are multiple regions with the same priority but with different farewell messages set, there would be multiple completing values), then the selected (or "winning") value will be undefined.A subject 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
RegionGroup.MEMBERS
and the given subject is not a member, then the region would be skipped when querying that flag. Ifnull
is provided for the subject, then only flags that useRegionGroup.ALL
,RegionGroup.NON_MEMBERS
, etc. will apply.- Parameters:
subject
- an optional subject, which would be used to determine the region group to applyflag
- the flag of typeMapFlag
key
- the key for the map flag- Returns:
- a value, which could be
null
-
queryAllValues
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.subject
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 subject argument is required if theFlags.BUILD
flag is the flag being queried.- Parameters:
subject
- an optional subject, which would be used to determine the region group to applyflag
- the flag- Returns:
- a collection of values
-
isOwnerOfAll
Test whether a player is an owner of all regions in this set.- Parameters:
player
- the player- Returns:
- whether the player is an owner of all regions
-
isMemberOfAll
Test whether a player is an owner or member of all regions in this set.- Parameters:
player
- the player- Returns:
- whether the player is a member of all regions
-
size
int size()Get the number of regions that are included.- Returns:
- the number of contained regions
-
getRegions
Set<ProtectedRegion> getRegions()Get an immutable set of regions that are included in this set.- Returns:
- a set of regions
-