Interface Selector
-
public interface Selector
Allows for the selection ofentities
in a world based on given criteria.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Selector.Builder
Creates aSelector
based on the provided criteria.static interface
Selector.Factory
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Selector.Builder
builder()
Provides aSelector.Builder
to build aSelector
.int
limit()
Gets the maximum number of entities that this selector can select.static Selector
parse(String string)
Attempts to parse the given string into a selector.boolean
playersOnly()
Collection<Entity>
select(CommandCause cause)
Select entities based on the criteria of this selector and a givenCommandCause
Collection<Entity>
select(Entity entity)
Select entities based on the criteria of this selector and a givenEntity
Collection<Entity>
select(ServerLocation location)
Select entities based on the criteria of this selector and a givenServerLocation
-
-
-
Method Detail
-
parse
static Selector parse(String string) throws 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:
IllegalArgumentException
- if the string could not be parsed.
-
builder
static Selector.Builder builder()
Provides aSelector.Builder
to build aSelector
.If you wish to create a selector based on a provided string, use
parse(String)
instead.- Returns:
- The builder
-
select
Collection<Entity> select(ServerLocation location) throws IllegalStateException
Select entities based on the criteria of this selector and a givenServerLocation
- Parameters:
location
- TheServerLocation
- Returns:
- A
Collection
of selectedentities
- Throws:
IllegalStateException
- if this selector cannot select based on aServerLocation
-
select
Collection<Entity> select(Entity entity) throws IllegalStateException
Select entities based on the criteria of this selector and a givenEntity
- Parameters:
entity
- TheEntity
- Returns:
- A
Collection
of selectedentities
- Throws:
IllegalStateException
- if this selector cannot select based on aEntity
-
select
Collection<Entity> select(CommandCause cause)
Select entities based on the criteria of this selector and a givenCommandCause
- Parameters:
cause
- TheCommandCause
- Returns:
- A
Collection
of 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
-
-