Interface Selector
-
public interface SelectorAllows for the selection ofentitiesin a world based on given criteria.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSelector.BuilderCreates aSelectorbased on the provided criteria.static interfaceSelector.Factory
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Selector.Builderbuilder()Provides aSelector.Builderto build aSelector.intlimit()Gets the maximum number of entities that this selector can select.static Selectorparse(java.lang.String string)Attempts to parse the given string into a selector.booleanplayersOnly()java.util.Collection<Entity>select(CommandCause cause)Select entities based on the criteria of this selector and a givenCommandCausejava.util.Collection<Entity>select(Entity entity)Select entities based on the criteria of this selector and a givenEntityjava.util.Collection<Entity>select(ServerLocation location)Select entities based on the criteria of this selector and a givenServerLocation
-
-
-
Method Detail
-
parse
static Selector parse(java.lang.String string) throws java.lang.IllegalArgumentException
Attempts to parse the given string into a selector. It must start with an @ symbol.- Parameters:
string- The string to parse- Returns:
- The
Selector - Throws:
java.lang.IllegalArgumentException- if the string could not be parsed.
-
builder
static Selector.Builder builder()
Provides aSelector.Builderto build aSelector.If you wish to create a selector based on a provided string, use
parse(String)instead.- Returns:
- The builder
-
select
java.util.Collection<Entity> select(ServerLocation location) throws java.lang.IllegalStateException
Select entities based on the criteria of this selector and a givenServerLocation- Parameters:
location- TheServerLocation- Returns:
- A
Collectionof selectedentities - Throws:
java.lang.IllegalStateException- if this selector cannot select based on aServerLocation
-
select
java.util.Collection<Entity> select(Entity entity) throws java.lang.IllegalStateException
Select entities based on the criteria of this selector and a givenEntity
-
select
java.util.Collection<Entity> select(CommandCause cause)
Select entities based on the criteria of this selector and a givenCommandCause- Parameters:
cause- TheCommandCause- Returns:
- A
Collectionof selectedentities
-
limit
int limit()
Gets the maximum number of entities that this selector can select.- Returns:
- The limit
-
playersOnly
boolean playersOnly()
- Returns:
- Whether this selector will only select players
-
-