WorldQuery
A query builder for filtering and sorting game worlds.
ClassRLPlugins API
public class WorldQuery extends AbstractQuery<World, WorldQuery>Members
Constructors
- newWorldQuery()
Initializes the WorldQuery with the list of available worlds from the WorldService.
Methods
- WorldQueryisF2p()
Filters the worlds to include only free-to-play worlds.
- WorldQueryisMainGame()
Filters the worlds to include only main game worlds (excluding special game modes).
- WorldQueryisP2p()
Filters the worlds to include only player-vs-player worlds.
- Worldnext()
Next.
- WorldQuerynotPvp()
Filters the worlds to exclude those with the PvP activity.
- WorldQuerynotSkillTotalWorlds()
Filters the worlds to exclude those with the skill total activity.
- Worldprevious()
Previous.
- WorldQueryskillTotalWorlds(int)
Filters the worlds to include only those with the skill total activity and a minimum level requirement less than or equal to the specified total.
- WorldQuerysortByIdAsc()
Sorts the worlds by their ID in ascending order.
- WorldQuerysortByIdDesc()
Sorts the worlds by their ID in descending order.
- WorldQuerysortByPlayerCountAsc()
Sorts the worlds by their player count in ascending order.
- WorldQuerysortByPlayerCountDesc()
Sorts the worlds by their player count in descending order.
- WorldQuerywithActivity(String)
Filters the worlds to include only those with the specified activity.
- WorldQuerywithId(int...)
Filters the worlds to include only members worlds.
- WorldQuerywithOutActivity(String)
Filters the worlds to exclude those with the specified activity.
- WorldQuerywithOutTypes(WorldType...)
Filters the worlds to exclude those with the specified types.
- WorldQuerywithPlayerCount(int)
Filters the worlds to include only those with the specified player count.
- WorldQuerywithPlayerCount(int, int)
Filters the worlds to include only those with a player count within the specified range.
- WorldQuerywithQualifyingSkillTotalWorlds()
Filters the skill total worlds, keeping those accessible based on the player's total skill level.
- WorldQuerywithRegion(WorldRegion...)
Filters the worlds to include only those in the specified regions.
- WorldQuerywithTypes(WorldType...)
Filters the worlds to include only those with the specified types.
Inherited from AbstractQuery
- Raggregate(Function<Stream<World>, R>)
Generic aggregation method for custom terminal operations Executes filters and allows custom stream processing.
- booleanall(Predicate<World>)
Check if all filtered results match the predicate.
- booleanany(Predicate<World>)
Check if any filtered result matches the predicate.
- List<World>collect()
Get the filtered/sorted list.
- Rcollect(Collector<World, ?, R>)
Execute filters and process with custom collector.
- intcount()
Get count of filtered results.
- WorldQuerydistinct()
Ensure results are distinct.
- Worldfirst()
Get the first element from the filtered/sorted list.
- voidfirstIfPresent(Consumer<World>)
First if present.
- voidfirstOrElse(Consumer<World>, Runnable)
Perform action on the first element, or else run elseAction if no results.
- voidforEach(Consumer<World>)
Executes filters and performs an action on each result.
- booleanisEmpty()
Check if there are no filtered results.
- WorldQuerykeepIf(Predicate<World>)
Lazily filter by predicate (keeps matching items).
- Worldlast()
Get the last element from the filtered/sorted list.
- voidlastOrElse(Consumer<World>, Runnable)
Perform action on the last element, or else run elseAction if no results.
- WorldQuerylimit(int)
Limit the number of results.
- booleannone(Predicate<World>)
Check if no filtered results match the predicate.
- WorldQuerypeek(Consumer<World>)
Peek at each element during processing.
- WorldQuerypostProcess(Function<List<World>, List<World>>)
Apply a post-processing function after sorting.
- Worldrandom()
Get a random element from the filtered/sorted list.
- WorldQueryremoveIf(Predicate<World>)
Lazily filter by predicate (removes matching items).
- WorldQueryskip(int)
Skip a number of results.
- WorldQuerysort(Comparator<World>)
Lazily add sorting.
WorldQuery()
public WorldQuery()Initializes the WorldQuery with the list of available worlds from the WorldService.
isF2p()
public WorldQuery isF2p()Filters the worlds to include only free-to-play worlds.
Returns
WorldQuery.
isMainGame()
public WorldQuery isMainGame()Filters the worlds to include only main game worlds (excluding special game modes).
Returns
WorldQuery.
isP2p()
public WorldQuery isP2p()Filters the worlds to include only player-vs-player worlds.
Returns
WorldQuery.
next()
public World next()Next.
notPvp()
public WorldQuery notPvp()Filters the worlds to exclude those with the PvP activity.
Returns
WorldQuery.
notSkillTotalWorlds()
public WorldQuery notSkillTotalWorlds()Filters the worlds to exclude those with the skill total activity.
Returns
WorldQuery.
previous()
public World previous()Previous.
skillTotalWorlds(int)
public WorldQuery skillTotalWorlds(int total)Filters the worlds to include only those with the skill total activity and a minimum level requirement less than or equal to the specified total.
Parameters
total- Total.
Returns
WorldQuery.
sortByIdAsc()
public WorldQuery sortByIdAsc()Sorts the worlds by their ID in ascending order.
Returns
WorldQuery.
sortByIdDesc()
public WorldQuery sortByIdDesc()Sorts the worlds by their ID in descending order.
Returns
WorldQuery.
sortByPlayerCountAsc()
public WorldQuery sortByPlayerCountAsc()Sorts the worlds by their player count in ascending order.
Returns
WorldQuery.
sortByPlayerCountDesc()
public WorldQuery sortByPlayerCountDesc()Sorts the worlds by their player count in descending order.
Returns
WorldQuery.
withActivity(String)
public WorldQuery withActivity(String activity)Filters the worlds to include only those with the specified activity.
Parameters
activity- The activity to filter by.
Returns
WorldQuery.
withId(int...)
public WorldQuery withId(int... id)Filters the worlds to include only members worlds.
Parameters
id- Id.
Returns
WorldQuery.
withOutActivity(String)
public WorldQuery withOutActivity(String activity)Filters the worlds to exclude those with the specified activity.
Parameters
activity- The activity to exclude.
Returns
WorldQuery.
withOutTypes(WorldType...)
public WorldQuery withOutTypes(WorldType... types)Filters the worlds to exclude those with the specified types.
Parameters
types- The types to exclude.
Returns
WorldQuery.
withPlayerCount(int)
public WorldQuery withPlayerCount(int count)Filters the worlds to include only those with the specified player count.
Parameters
count- The exact player count to filter by.
Returns
WorldQuery.
withPlayerCount(int, int)
public WorldQuery withPlayerCount(int min, int max)Filters the worlds to include only those with a player count within the specified range.
Parameters
min- The minimum player count.
max- The maximum player count.
Returns
WorldQuery.
withQualifyingSkillTotalWorlds()
public WorldQuery withQualifyingSkillTotalWorlds()Filters the skill total worlds, keeping those accessible based on the player's total skill level.
Returns
A new WorldQuery with worlds that meet the skill total requirements.
withRegion(WorldRegion...)
public WorldQuery withRegion(WorldRegion... region)Filters the worlds to include only those in the specified regions.
Parameters
region- The regions to filter by.
Returns
WorldQuery.
withTypes(WorldType...)
public WorldQuery withTypes(WorldType... types)Filters the worlds to include only those with the specified types.
Parameters
types- The types to filter by.
Returns
WorldQuery.
aggregate(Function<Stream<World>, R>)from AbstractQuery
public R aggregate(Function<Stream<World>, R> aggregator)Generic aggregation method for custom terminal operations Executes filters and allows custom stream processing.
Parameters
aggregator- Aggregator.
all(Predicate<World>)from AbstractQuery
public boolean all(Predicate<World> predicate)Check if all filtered results match the predicate.
Parameters
predicate- Predicate to test.
Returns
True if all match, false otherwise.
any(Predicate<World>)from AbstractQuery
public boolean any(Predicate<World> predicate)Check if any filtered result matches the predicate.
Parameters
predicate- Predicate to test.
Returns
True if any match, false otherwise.
collect()from AbstractQuery
public List<World> collect()Get the filtered/sorted list.
collect(Collector<World, ?, R>)from AbstractQuery
public R collect(Collector<World, ?, R> collector)Execute filters and process with custom collector.
Parameters
collector- Collector.
count()from AbstractQuery
public int count()Get count of filtered results.
distinct()from AbstractQuery
public WorldQuery distinct()Ensure results are distinct.
Returns
The query instance.
first()from AbstractQuery
public World first()Get the first element from the filtered/sorted list.
firstIfPresent(Consumer<World>)from AbstractQuery
public void firstIfPresent(Consumer<World> action)First if present.
Parameters
action- Action.
firstOrElse(Consumer<World>, Runnable)from AbstractQuery
public void firstOrElse(Consumer<World> action, Runnable elseAction)Perform action on the first element, or else run elseAction if no results.
Parameters
action- Action to perform on the first element.
elseAction- Action to perform if no results.
forEach(Consumer<World>)from AbstractQuery
public void forEach(Consumer<World> action)Executes filters and performs an action on each result.
Parameters
action- Action.
isEmpty()from AbstractQuery
public boolean isEmpty()Check if there are no filtered results.
Returns
True if no results after filtering, false otherwise.
keepIf(Predicate<World>)from AbstractQuery
public WorldQuery keepIf(Predicate<World> predicate)Lazily filter by predicate (keeps matching items).
Parameters
predicate- Predicate.
Returns
The query instance.
last()from AbstractQuery
public World last()Get the last element from the filtered/sorted list.
lastOrElse(Consumer<World>, Runnable)from AbstractQuery
public void lastOrElse(Consumer<World> action, Runnable elseAction)Perform action on the last element, or else run elseAction if no results.
Parameters
action- Action to perform on the last element.
elseAction- Action to perform if no results.
limit(int)from AbstractQuery
public WorldQuery limit(int maxSize)Limit the number of results.
Parameters
maxSize- Max size.
Returns
The query instance.
none(Predicate<World>)from AbstractQuery
public boolean none(Predicate<World> predicate)Check if no filtered results match the predicate.
Parameters
predicate- Predicate to test.
Returns
True if none match, false otherwise.
peek(Consumer<World>)from AbstractQuery
public WorldQuery peek(Consumer<World> action)Peek at each element during processing.
Parameters
action- Action to perform on each element.
Returns
The query instance.
postProcess(Function<List<World>, List<World>>)from AbstractQuery
public WorldQuery postProcess(Function<List<World>, List<World>> processor)Apply a post-processing function after sorting.
Useful for reordering algorithms that can't be expressed as Comparators.
Parameters
processor- Function to transform the result list.
Returns
The query instance.
random()from AbstractQuery
public World random()Get a random element from the filtered/sorted list.
removeIf(Predicate<World>)from AbstractQuery
public WorldQuery removeIf(Predicate<World> predicate)Lazily filter by predicate (removes matching items).
Parameters
predicate- Predicate.
Returns
The query instance.
skip(int)from AbstractQuery
public WorldQuery skip(int count)Skip a number of results.
Parameters
count- Count.
Returns
The query instance.
sort(Comparator<World>)from AbstractQuery
public WorldQuery sort(Comparator<World> comparator)Lazily add sorting.
Parameters
comparator- Comparator.
Returns
The query instance.
Also allowed
Every class has these, as in plain Java.
equals, toString