Class ItemQuery
java.lang.Object
privbot.query.ItemQuery
Fluent filter chain over inventory-style slot rows wrapped as
PrivItem.
Built by ctx.inventory.query(), ctx.bank and ctx.equipment. Rows are a
snapshot of the container when the query was built. Filters narrow the query in place, so a
query is single-use. Name filters resolve each item's name (marshalled per item); an item whose
name cannot be resolved reads as "item:<id>" and matches no name, so an empty result is
not proof the item is absent; filter by id when you have one.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanempty()True when no row is left.Narrows this query in place and returns it.first()The first remaining row (lowest slot first unless sorted), or null when empty.First slot matchingpredwithout mutating the fluent chain’s prior filters incorrectly — uses a stream view.list()An unmodifiable view of the remaining rows.Drops empty or placeholder rows (id 0 or less).quantityGreaterThan(int n) Same asquantityOver(int); KSBot-style name.quantityOver(int n) Keeps rows whose quantity is strictly greater thann.intsize()The number of rows left (slots, not total quantity).sort(Comparator<PrivItem> comparator) Sort the working list in place (e.g.Alias offilter(Predicate).withAction(String... actions) Keeps items whose definition exposes at least one of the given actions (e.g.withId(int... ids) Keeps items whose id is one ofids; no ids leaves the query unchanged.Keeps items whose name contains any ofnames(case-insensitive substring), so"Shark"also matches"Raw shark".withSlot(int slot) Keeps the row in container slotslot(0-based).
-
Method Details
-
withName
-
withId
Keeps items whose id is one ofids; no ids leaves the query unchanged. -
withAction
-
filter
-
where
Alias offilter(Predicate). -
sort
Sort the working list in place (e.g.ConsumableSelectionOrder.lowestPotionDoseThenLowestSlot()). -
nonPlaceholder
Drops empty or placeholder rows (id 0 or less). -
quantityOver
Keeps rows whose quantity is strictly greater thann. -
quantityGreaterThan
Same asquantityOver(int); KSBot-style name. -
withSlot
Keeps the row in container slotslot(0-based). -
first
The first remaining row (lowest slot first unless sorted), or null when empty. -
first
-
empty
public boolean empty()True when no row is left. -
size
public int size()The number of rows left (slots, not total quantity). -
list
-