ShopQuery
Query class for searching and filtering shops.
ClassRLPlugins API
public class ShopQuery extends AbstractQuery<Shop, ShopQuery>Provides a fluent API for chaining filter and sort operations.
Members
Constructors
- newShopQuery()
Create a new ShopQuery with all shops.
Methods
- ShopQueryatLocation(WorldPoint)
Filter to shops at a specific location.
- ShopQuerycanAccess()
Filter to only shops the player can currently access.
- Shopfurthest()
Get the furthest shop from the filtered list.
- Shopfurthest(WorldPoint)
Get the furthest shop from a specific point.
- ShopgetCurrent()
Get the currently open shop.
- ShoplongestGlobalPath()
Get the shop with the longest global path from the filtered list.
- ShoplongestPath()
Get the shop with the longest walking path from the filtered list.
- Shopnearest()
Get the nearest shop from the filtered list.
- Shopnearest(WorldPoint)
Get the nearest shop to a specific point.
- ShopshortestGlobalPath()
Get the shop with the shortest global path from the filtered list.
- ShopshortestPath()
Get the shop with the shortest walking path from the filtered list.
- ShopQuerysortFurthest()
Sort shops by Euclidean distance from the player (furthest first).
- ShopQuerysortFurthest(WorldPoint)
Sort shops by Euclidean distance from a specific point (furthest first).
- ShopQuerysortLongestGlobalPath()
Sort shops by global pathfinding distance from player (furthest first).
- ShopQuerysortLongestPath()
Sort shops by pathfinding distance from player (furthest first).
- ShopQuerysortLongestPath(WorldPoint)
Sort shops by pathfinding distance from a specific point (furthest first).
- ShopQuerysortNearest()
Sort shops by Euclidean distance from player (nearest first).
- ShopQuerysortNearest(WorldPoint)
Sort shops by Euclidean distance from a specific point (nearest first).
- ShopQuerysortShortestGlobalPath()
Sort shops by global pathfinding distance from player (nearest first).
- ShopQuerysortShortestPath()
Sort shops by pathfinding distance from player (nearest first).
- ShopQuerysortShortestPath(WorldPoint)
Sort shops by pathfinding distance from a specific point (nearest first).
- ShopQuerywithin(int)
Filter to shops within a certain distance from the player.
- ShopQuerywithin(WorldPoint, int)
Filter to shops within a certain distance from a specific point.
- ShopQuerywithInventoryId(int...)
Filter shops by their inventory IDs.
- ShopQuerywithName(String)
Filter shops by the exact enum name (case-insensitive).
- ShopQuerywithNameContains(String)
Filter shops whose enum name contains the specified substring (case-insensitive).
- ShopQuerywithNameMatches(String)
Filter shops whose enum name matches a wildcard pattern (case-insensitive).
- ShopQuerywithNames(String...)
Filter shops by multiple exact enum names (case-insensitive).
- ShopQuerywithoutRequirements()
Filter to shops without requirements.
- ShopQuerywithRequirements()
Filter to shops with specific requirements.
- ShopQuerywithShopkeeper(NpcLocations...)
Filter shops by shopkeeper NPC.
- ShopQuerywithShopkeeperNameContains(String)
Filter shops by shopkeeper name containing substring (case-insensitive).
- ShopQuerywithShopkeeperNameMatches(String)
Filter shops by shopkeeper name matching a wildcard pattern (case-insensitive).
Inherited from AbstractQuery
- Raggregate(Function<Stream<Shop>, R>)
Generic aggregation method for custom terminal operations Executes filters and allows custom stream processing.
- booleanall(Predicate<Shop>)
Check if all filtered results match the predicate.
- booleanany(Predicate<Shop>)
Check if any filtered result matches the predicate.
- List<Shop>collect()
Get the filtered/sorted list.
- Rcollect(Collector<Shop, ?, R>)
Execute filters and process with custom collector.
- intcount()
Get count of filtered results.
- ShopQuerydistinct()
Ensure results are distinct.
- Shopfirst()
Get the first element from the filtered/sorted list.
- voidfirstIfPresent(Consumer<Shop>)
First if present.
- voidfirstOrElse(Consumer<Shop>, Runnable)
Perform action on the first element, or else run elseAction if no results.
- voidforEach(Consumer<Shop>)
Executes filters and performs an action on each result.
- booleanisEmpty()
Check if there are no filtered results.
- ShopQuerykeepIf(Predicate<Shop>)
Lazily filter by predicate (keeps matching items).
- Shoplast()
Get the last element from the filtered/sorted list.
- voidlastOrElse(Consumer<Shop>, Runnable)
Perform action on the last element, or else run elseAction if no results.
- ShopQuerylimit(int)
Limit the number of results.
- booleannone(Predicate<Shop>)
Check if no filtered results match the predicate.
- ShopQuerypeek(Consumer<Shop>)
Peek at each element during processing.
- ShopQuerypostProcess(Function<List<Shop>, List<Shop>>)
Apply a post-processing function after sorting.
- Shoprandom()
Get a random element from the filtered/sorted list.
- ShopQueryremoveIf(Predicate<Shop>)
Lazily filter by predicate (removes matching items).
- ShopQueryskip(int)
Skip a number of results.
- ShopQuerysort(Comparator<Shop>)
Lazily add sorting.
ShopQuery()
public ShopQuery()Create a new ShopQuery with all shops.
atLocation(WorldPoint)
public ShopQuery atLocation(WorldPoint location)Filter to shops at a specific location.
Parameters
location- World point to match.
Returns
This ShopQuery for method chaining.
canAccess()
public ShopQuery canAccess()Filter to only shops the player can currently access.
Returns
This ShopQuery for method chaining.
furthest()
public Shop furthest()Get the furthest shop from the filtered list.
Terminal operation - executes the query.
Returns
Furthest Shop or null if none found.
furthest(WorldPoint)
public Shop furthest(WorldPoint center)Get the furthest shop from a specific point.
Terminal operation - executes the query.
Parameters
center- Center point.
Returns
Furthest Shop or null if none found.
getCurrent()
public Shop getCurrent()Get the currently open shop.
Terminal operation - does NOT use filtered results, always returns current open shop.
Returns
Currently open Shop or null if no shop is open.
longestGlobalPath()
public Shop longestGlobalPath()Get the shop with the longest global path from the filtered list.
Terminal operation - executes the query.
Returns
Shop with the longest global path or null if none found.
longestPath()
public Shop longestPath()Get the shop with the longest walking path from the filtered list.
Terminal operation - executes the query.
Returns
Shop with the longest path or null if none found.
nearest()
public Shop nearest()Get the nearest shop from the filtered list.
Terminal operation - executes the query.
Returns
Nearest Shop or null if none found.
nearest(WorldPoint)
public Shop nearest(WorldPoint center)Get the nearest shop to a specific point.
Terminal operation - executes the query.
Parameters
center- Center point.
Returns
Nearest Shop or null if none found.
shortestGlobalPath()
public Shop shortestGlobalPath()Get the shop with the shortest global path from the filtered list.
Terminal operation - executes the query.
Returns
Shop with the shortest global path or null if none found.
shortestPath()
public Shop shortestPath()Get the shop with the shortest walking path from the filtered list.
Terminal operation - executes the query.
Returns
Shop with the shortest path or null if none found.
sortFurthest()
public ShopQuery sortFurthest()Sort shops by Euclidean distance from the player (furthest first).
Returns
This ShopQuery for method chaining.
sortFurthest(WorldPoint)
public ShopQuery sortFurthest(WorldPoint center)Sort shops by Euclidean distance from a specific point (furthest first).
Parameters
center- Center point.
Returns
This ShopQuery for method chaining.
sortLongestGlobalPath()
public ShopQuery sortLongestGlobalPath()Sort shops by global pathfinding distance from player (furthest first).
Uses a Walker pathfinding system which accounts for transports and teleports.
Returns
This ShopQuery for method chaining.
sortLongestPath()
public ShopQuery sortLongestPath()Sort shops by pathfinding distance from player (furthest first).
Returns
This ShopQuery for method chaining.
sortLongestPath(WorldPoint)
public ShopQuery sortLongestPath(WorldPoint center)Sort shops by pathfinding distance from a specific point (furthest first).
Parameters
center- Center point.
Returns
This ShopQuery for method chaining.
sortNearest()
public ShopQuery sortNearest()Sort shops by Euclidean distance from player (nearest first).
Returns
This ShopQuery for method chaining.
sortNearest(WorldPoint)
public ShopQuery sortNearest(WorldPoint center)Sort shops by Euclidean distance from a specific point (nearest first).
Parameters
center- Center point.
Returns
This ShopQuery for method chaining.
sortShortestGlobalPath()
public ShopQuery sortShortestGlobalPath()Sort shops by global pathfinding distance from player (nearest first).
Uses a Walker pathfinding system which accounts for transports and teleports.
Returns
This ShopQuery for method chaining.
sortShortestPath()
public ShopQuery sortShortestPath()Sort shops by pathfinding distance from player (nearest first).
Uses Distance.pathDistanceTo() for accurate walking distance.
Returns
This ShopQuery for method chaining.
sortShortestPath(WorldPoint)
public ShopQuery sortShortestPath(WorldPoint center)Sort shops by pathfinding distance from a specific point (nearest first).
Parameters
center- Center point.
Returns
This ShopQuery for method chaining.
within(int)
public ShopQuery within(int distance)Filter to shops within a certain distance from the player.
Parameters
distance- Maximum distance in tiles.
Returns
This ShopQuery for method chaining.
within(WorldPoint, int)
public ShopQuery within(WorldPoint center, int distance)Filter to shops within a certain distance from a specific point.
Parameters
center- Center point.
distance- Maximum distance in tiles.
Returns
This ShopQuery for method chaining.
withInventoryId(int...)
public ShopQuery withInventoryId(int... ids)Filter shops by their inventory IDs.
Parameters
ids- Inventory IDs to filter by.
Returns
This ShopQuery for method chaining.
withName(String)
public ShopQuery withName(String name)Filter shops by the exact enum name (case-insensitive).
Parameters
name- Exact shop enum name.
Returns
This ShopQuery for method chaining.
withNameContains(String)
public ShopQuery withNameContains(String namePart)Filter shops whose enum name contains the specified substring (case-insensitive).
Parameters
namePart- Substring to search for in shop name.
Returns
This ShopQuery for method chaining.
withNameMatches(String)
public ShopQuery withNameMatches(String pattern)Filter shops whose enum name matches a wildcard pattern (case-insensitive).
Supports '*' (any characters) and '?' (single character).
Parameters
pattern- Wildcard pattern.
Returns
This ShopQuery for method chaining.
withNames(String...)
public ShopQuery withNames(String... names)Filter shops by multiple exact enum names (case-insensitive).
Parameters
names- Shop enum names to filter by.
Returns
This ShopQuery for method chaining.
withoutRequirements()
public ShopQuery withoutRequirements()Filter to shops without requirements.
Returns
This ShopQuery for method chaining.
withRequirements()
public ShopQuery withRequirements()Filter to shops with specific requirements.
Returns
This ShopQuery for method chaining.
withShopkeeper(NpcLocations...)
public ShopQuery withShopkeeper(NpcLocations... shopkeepers)Filter shops by shopkeeper NPC.
Parameters
shopkeepers- NPC locations to filter by.
Returns
This ShopQuery for method chaining.
withShopkeeperNameContains(String)
public ShopQuery withShopkeeperNameContains(String namePart)Filter shops by shopkeeper name containing substring (case-insensitive).
Useful for finding all shops with shopkeepers like "BARTENDER", "TRADER", etc.
Parameters
namePart- Substring to search for in shopkeeper enum name.
Returns
This ShopQuery for method chaining.
withShopkeeperNameMatches(String)
public ShopQuery withShopkeeperNameMatches(String pattern)Filter shops by shopkeeper name matching a wildcard pattern (case-insensitive).
Supports '*' (any characters) and '?' (single character).
Parameters
pattern- Wildcard pattern to match against shopkeeper enum name.
Returns
This ShopQuery for method chaining.
aggregate(Function<Stream<Shop>, R>)from AbstractQuery
public R aggregate(Function<Stream<Shop>, R> aggregator)Generic aggregation method for custom terminal operations Executes filters and allows custom stream processing.
Parameters
aggregator- Aggregator.
all(Predicate<Shop>)from AbstractQuery
public boolean all(Predicate<Shop> predicate)Check if all filtered results match the predicate.
Parameters
predicate- Predicate to test.
Returns
True if all match, false otherwise.
any(Predicate<Shop>)from AbstractQuery
public boolean any(Predicate<Shop> 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<Shop> collect()Get the filtered/sorted list.
collect(Collector<Shop, ?, R>)from AbstractQuery
public R collect(Collector<Shop, ?, 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 ShopQuery distinct()Ensure results are distinct.
Returns
The query instance.
first()from AbstractQuery
public Shop first()Get the first element from the filtered/sorted list.
firstIfPresent(Consumer<Shop>)from AbstractQuery
public void firstIfPresent(Consumer<Shop> action)First if present.
Parameters
action- Action.
firstOrElse(Consumer<Shop>, Runnable)from AbstractQuery
public void firstOrElse(Consumer<Shop> 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<Shop>)from AbstractQuery
public void forEach(Consumer<Shop> 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<Shop>)from AbstractQuery
public ShopQuery keepIf(Predicate<Shop> predicate)Lazily filter by predicate (keeps matching items).
Parameters
predicate- Predicate.
Returns
The query instance.
last()from AbstractQuery
public Shop last()Get the last element from the filtered/sorted list.
lastOrElse(Consumer<Shop>, Runnable)from AbstractQuery
public void lastOrElse(Consumer<Shop> 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 ShopQuery limit(int maxSize)Limit the number of results.
Parameters
maxSize- Max size.
Returns
The query instance.
none(Predicate<Shop>)from AbstractQuery
public boolean none(Predicate<Shop> predicate)Check if no filtered results match the predicate.
Parameters
predicate- Predicate to test.
Returns
True if none match, false otherwise.
peek(Consumer<Shop>)from AbstractQuery
public ShopQuery peek(Consumer<Shop> action)Peek at each element during processing.
Parameters
action- Action to perform on each element.
Returns
The query instance.
postProcess(Function<List<Shop>, List<Shop>>)from AbstractQuery
public ShopQuery postProcess(Function<List<Shop>, List<Shop>> 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 Shop random()Get a random element from the filtered/sorted list.
removeIf(Predicate<Shop>)from AbstractQuery
public ShopQuery removeIf(Predicate<Shop> predicate)Lazily filter by predicate (removes matching items).
Parameters
predicate- Predicate.
Returns
The query instance.
skip(int)from AbstractQuery
public ShopQuery skip(int count)Skip a number of results.
Parameters
count- Count.
Returns
The query instance.
sort(Comparator<Shop>)from AbstractQuery
public ShopQuery sort(Comparator<Shop> comparator)Lazily add sorting.
Parameters
comparator- Comparator.
Returns
The query instance.
Also allowed
Every class has these, as in plain Java.
equals, toString