Class GroundItemQuery
java.lang.Object
privbot.query.GroundItemQuery
Fluent filter chain over ground item stacks, built by
ctx.groundItems.query().
Each PrivGroundItem is a snapshot taken when the query was built (id, quantity,
tile); use PrivGroundItem.exists() to check that a stack is still there. Filters narrow
the query in place, so a query is single-use.
-
Constructor Summary
ConstructorsConstructorDescriptionGroundItemQuery(List<PrivGroundItem> raw, net.runelite.api.Client client) Wraps a copy ofraw; plugins normally get a query fromctx.groundItems.query(). -
Method Summary
Modifier and TypeMethodDescriptionclosest()The stack nearest the local player in tile steps; stacks on another plane rank last.closest(Predicate<PrivGroundItem> pred) Filter then nearest to the player (Scar / DreamBotGroundItems.closest(pred)style).booleanempty()True when no entry is left.filter(Predicate<PrivGroundItem> pred) Narrows this query in place and returns it.first()The first remaining entry in snapshot order, or null when the query is empty.list()An unmodifiable view of the remaining entries.nearest()Alias ofclosest().nearest(Predicate<PrivGroundItem> pred) Alias ofclosest(Predicate).intsize()The number of entries left.where(Predicate<PrivGroundItem> pred) Alias offilter(Predicate).withId(int... ids) Keeps stacks whose item id is one ofids; no ids leaves the query unchanged.withinTiles(int maxTiles) Chebyshev distance on the current plane (OSRS tile steps).Keeps stacks whose item name contains any ofnames(case-insensitive substring).
-
Constructor Details
-
GroundItemQuery
Wraps a copy ofraw; plugins normally get a query fromctx.groundItems.query().
-
-
Method Details
-
withName
Keeps stacks whose item name contains any ofnames(case-insensitive substring). A stack whose name cannot be resolved reads as"item:<id>"and matches nothing. -
withId
Keeps stacks whose item id is one ofids; no ids leaves the query unchanged. -
withinTiles
Chebyshev distance on the current plane (OSRS tile steps). -
filter
Narrows this query in place and returns it. Queries are mutable and single-use; the predicate runs on the calling thread. -
where
Alias offilter(Predicate). -
closest
The stack nearest the local player in tile steps; stacks on another plane rank last. When the player's position cannot be read this returns the first entry; null when empty. -
closest
Filter then nearest to the player (Scar / DreamBotGroundItems.closest(pred)style). -
nearest
Alias ofclosest(). -
nearest
Alias ofclosest(Predicate). -
first
The first remaining entry in snapshot order, or null when the query is empty. -
list
An unmodifiable view of the remaining entries. -
empty
public boolean empty()True when no entry is left. -
size
public int size()The number of entries left.
-