public class RegionResultSet extends AbstractRegionSet
| Constructor and Description |
|---|
RegionResultSet(java.util.List<ProtectedRegion> applicable,
ProtectedRegion globalRegion)
Create a new region result set.
|
RegionResultSet(java.util.List<ProtectedRegion> applicable,
ProtectedRegion globalRegion,
boolean sorted)
Create a new region result set.
|
RegionResultSet(java.util.Set<ProtectedRegion> applicable,
ProtectedRegion globalRegion)
Create a new region result set.
|
| Modifier and Type | Method and Description |
|---|---|
static RegionResultSet |
fromSortedList(java.util.List<ProtectedRegion> regions,
ProtectedRegion globalRegion)
Create a new instance using a list of regions that is known to
already be sorted by priority descending.
|
java.util.Set<ProtectedRegion> |
getRegions()
Get 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 |
isVirtual()
Return whether this region set is a virtual set.
|
java.util.Iterator<ProtectedRegion> |
iterator() |
<V> java.util.Collection<V> |
queryAllValues(RegionAssociable subject,
Flag<V> flag)
Get the effective values for a flag, returning a collection of all
values.
|
StateFlag.State |
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.
|
testStatepublic RegionResultSet(java.util.List<ProtectedRegion> applicable, @Nullable ProtectedRegion globalRegion)
The given list must not contain duplicates or the behavior of this instance will be undefined.
applicable - the regions contained in this setglobalRegion - the global region, set aside for special handling.public RegionResultSet(java.util.Set<ProtectedRegion> applicable, @Nullable ProtectedRegion globalRegion)
applicable - the regions contained in this setglobalRegion - the global region, set aside for special handling.public RegionResultSet(java.util.List<ProtectedRegion> applicable, @Nullable ProtectedRegion globalRegion, boolean sorted)
The list of regions may be first sorted with
NormativeOrders. If that is the case, sorted should be
true. Otherwise, the list will be sorted in-place.
applicable - the regions contained in this setglobalRegion - the global region, set aside for special handling.sorted - true if the list is already sorted with NormativeOrderspublic boolean isVirtual()
ApplicableRegionSetA 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 or
FailedLoadRegionSet, among other possibilities.
FailedLoadRegionSet@Nullable public StateFlag.State queryState(@Nullable RegionAssociable subject, StateFlag... flags)
ApplicableRegionSetDENY overrides ALLOW,
and ALLOW overrides NONE. 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. (FlagUtil on a region can be changed so that they only apply
to certain users.) The subject argument is required if the
Flags.BUILD flag is in the list of flags.
queryState in interface ApplicableRegionSetqueryState in class AbstractRegionSetsubject - an optional subject, which would be used to determine the region groups that applyflags - a list of flags to check@Nullable
public <V> V queryValue(@Nullable
RegionAssociable subject,
Flag<V> flag)
ApplicableRegionSetOnly 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. (FlagUtil on a region can be changed so that they only apply
to certain users.) The subject argument is required if the
Flags.BUILD flag is the flag being queried.
subject - an optional subject, which would be used to determine the region group to applyflag - the flagnullpublic <V> java.util.Collection<V> queryAllValues(@Nullable
RegionAssociable subject,
Flag<V> flag)
ApplicableRegionSetsubject 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. (FlagUtil on a region can be changed so that they only apply
to certain users.) The subject argument is required if the
Flags.BUILD flag is the flag being queried.
subject - an optional subject, which would be used to determine the region group to applyflag - the flagpublic boolean isOwnerOfAll(LocalPlayer player)
ApplicableRegionSetplayer - the playerpublic boolean isMemberOfAll(LocalPlayer player)
ApplicableRegionSetplayer - the playerpublic int size()
ApplicableRegionSetpublic java.util.Set<ProtectedRegion> getRegions()
ApplicableRegionSetpublic java.util.Iterator<ProtectedRegion> iterator()
public static RegionResultSet fromSortedList(java.util.List<ProtectedRegion> regions, @Nullable ProtectedRegion globalRegion)
regions - a list of regionsglobalRegion - a global region