Class WorldQuery
- java.lang.Object
-
- com.kraken.api.core.AbstractQuery<WorldEntity,WorldQuery,net.runelite.api.World>
-
- com.kraken.api.query.world.WorldQuery
-
public class WorldQuery extends AbstractQuery<WorldEntity,WorldQuery,net.runelite.api.World>
-
-
Field Summary
-
Fields inherited from class com.kraken.api.core.AbstractQuery
ctx
-
-
Constructor Summary
Constructors Constructor Description WorldQuery(Context ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WorldQueryfreeToPlay()Filters the current query to include only free-to-play worlds.WorldQueryinRegion(net.runelite.http.api.worlds.WorldRegion... region)Filters the current query to include only worlds that belong to the specified regions.WorldQuerymembers()Filters the current query to include only members-only worlds.WorldQuerynameContains(java.lang.String search)Filters for entities whose name contains the substring or a portion of the name parameter.WorldEntitynext()Retrieves the next WorldEntity in the sorted list whose world ID is greater than the current world ID.WorldQuerynonPvp()Filters the query to exclude worlds of thePVPtype.WorldQuerynonSkillTotalWorlds()Retrieves a query for worlds that exclude the SKILL_TOTAL type.WorldQueryonlySkillTotal(int total)Filters the current query to include only worlds with a skill total requirement less than or equal to the specified value.WorldQueryonlyValidSkillTotal()Filters the current query to include only worlds with valid skill total level requirements that the local player's total skill level satisfies.WorldEntityprevious()Retrieves the previous World in the sorted list of worlds based on the current world number.WorldQuerysortByWorldNumberAsc()Sorts the query results in ascending order based on the world number (ID).WorldQuerysortedByPlayersDesc()Sorts the current query's worlds by their player counts in descending order.WorldQuerysortedByWorldNumberDesc()Sorts the current query's worlds by their world numbers in descending order.protected java.util.function.Supplier<java.util.stream.Stream<WorldEntity>>source()WorldQuerystandard()Configures and returns aWorldQueryobject that excludes specific world types which are not part of the "standard" main game world category.WorldQuerywithActivity(java.lang.String activity)Filters the current query to include only worlds associated with the specified activity.WorldQuerywithName(java.lang.String name)Filters for only entities whose name matches the provided name.WorldQuerywithOutTypes(net.runelite.api.WorldType... types)Filters the query to exclude worlds that contain any of the specified types.WorldQuerywithPlayerCountBetween(int min, int max)Filters the current query to include only worlds with a player count within the specified range.WorldQuerywithPlayerCountLessThan(int count)Filters the current query to include only worlds with a player count less than the specified value.WorldQuerywithTypes(net.runelite.api.WorldType... types)Filters the current query to include only worlds that match any of the specifiedWorldTypevalues.
-
-
-
Constructor Detail
-
WorldQuery
public WorldQuery(Context ctx)
-
-
Method Detail
-
source
protected java.util.function.Supplier<java.util.stream.Stream<WorldEntity>> source()
- Specified by:
sourcein classAbstractQuery<WorldEntity,WorldQuery,net.runelite.api.World>
-
withName
public WorldQuery withName(java.lang.String name)
Description copied from class:AbstractQueryFilters for only entities whose name matches the provided name. This is case-insensitive.- Overrides:
withNamein classAbstractQuery<WorldEntity,WorldQuery,net.runelite.api.World>- Parameters:
name- The name of the object to filter for- Returns:
- Q entities whose name matches
-
nameContains
public WorldQuery nameContains(java.lang.String search)
Description copied from class:AbstractQueryFilters for entities whose name contains the substring or a portion of the name parameter.- Overrides:
nameContainsin classAbstractQuery<WorldEntity,WorldQuery,net.runelite.api.World>- Parameters:
search- The name to match against- Returns:
- Entities whose name contains the prefix
-
freeToPlay
public WorldQuery freeToPlay()
Filters the current query to include only free-to-play worlds.This method modifies the query to exclude any worlds classified as
MEMBERS-only. Free-to-play worlds are worlds that do not have theWorldType.MEMBERStag.- Returns:
- A
WorldQueryobject filtered to include only free-to-play worlds.
-
members
public WorldQuery members()
Filters the current query to include only members-only worlds.This method modifies the query to include only worlds classified as @WorldType.MEMBERS. Members-only worlds are worlds that require an active membership subscription to access.
- Returns:
- A
WorldQueryobject filtered to include only members-only worlds.
-
withTypes
public WorldQuery withTypes(net.runelite.api.WorldType... types)
Filters the current query to include only worlds that match any of the specifiedWorldTypevalues.This method modifies the query to include worlds where their list of types contains at least one of the provided
WorldTypevalues. If the world's types arenull, it will be excluded from the filtered results.- Parameters:
types- An array ofWorldTypevalues to filter worlds by. Only worlds containing one or more of the specified types will be included in the results.- Returns:
- A
WorldQueryobject filtered to include only worlds matching the specified types.
-
withOutTypes
public WorldQuery withOutTypes(net.runelite.api.WorldType... types)
Filters the query to exclude worlds that contain any of the specified types.This method ensures that the resulting query does not include any worlds where the types match those provided in the
typesparameter.- Parameters:
types- an array of @WorldType that specifies the types to exclude from the query. Ifnullor empty, no types will be excluded.- Returns:
- a @WorldQuery instance with the applied filter to exclude the specified types.
-
onlySkillTotal
public WorldQuery onlySkillTotal(int total)
Filters the current query to include only worlds with a skill total requirement less than or equal to the specified value.This method modifies the query to include only worlds that:
- Have the @WorldType.SKILL_TOTAL tag in their list of types.
- Have a skill total requirement, determined by numeric parsing of the world's activity description.
- Parameters:
total- The maximum skill total value (inclusive) to include in the filtered results. Worlds with a skill total requirement greater than this value will be excluded.- Returns:
- A
WorldQueryobject filtered to include only worlds with a skill total requirement less than or equal to the specified total.
-
onlyValidSkillTotal
public WorldQuery onlyValidSkillTotal()
Filters the current query to include only worlds with valid skill total level requirements that the local player's total skill level satisfies.This method modifies the query to include only worlds meeting the following conditions:
- The world has the @WorldType.SKILL_TOTAL tag in its list of types.
- The world has a valid numerical skill total requirement, determined by extracting and parsing the numeric value from the world's activity description.
- The player's total skill level is greater than or equal to the world's skill total requirement.
- Returns:
- A
WorldQueryobject filtered to include only worlds with skill total requirements that are valid and met by the local player's total skill level.
-
withActivity
public WorldQuery withActivity(java.lang.String activity)
Filters the current query to include only worlds associated with the specified activity.This method modifies the query to match worlds where the activity description (if not
null) contains the provided activity string, after sanitizing and performing a case-insensitive comparison.- Parameters:
activity- The activity string to filter worlds by. This value is case-insensitive and will be sanitized before matching.- Returns:
- A
WorldQueryobject filtered to include only worlds matching the specified activity.
-
inRegion
public WorldQuery inRegion(net.runelite.http.api.worlds.WorldRegion... region)
Filters the current query to include only worlds that belong to the specified regions.This method modifies the query to match worlds where their associated region matches any of the provided
WorldRegionvalues. If the world's region isnull, it will be excluded from the filtered results.- Parameters:
region- An array ofWorldRegionvalues to filter worlds by. Only worlds belonging to one or more of the specified regions will be included in the results.- Returns:
- A
WorldQueryobject filtered to include only worlds belonging to the specified regions.
-
withPlayerCountBetween
public WorldQuery withPlayerCountBetween(int min, int max)
Filters the current query to include only worlds with a player count within the specified range.This method modifies the query to include only worlds where the player count falls between the given minimum and maximum values (inclusive). Worlds with player counts outside this range will be excluded from the results.
- Parameters:
min- The minimum player count (inclusive) to include in the filtered results.max- The maximum player count (inclusive) to include in the filtered results.- Returns:
- A
WorldQueryobject filtered to include only worlds with player counts within the specified range.
-
withPlayerCountLessThan
public WorldQuery withPlayerCountLessThan(int count)
Filters the current query to include only worlds with a player count less than the specified value.This method modifies the query to exclude any worlds where the player count is greater than or equal to the provided
countvalue.- Parameters:
count- The maximum player count (exclusive) to include in the filtered results. Only worlds with a player count less than this value will be included.- Returns:
- A
WorldQueryobject filtered to include only worlds with a player count less than the specified value.
-
sortedByPlayersDesc
public WorldQuery sortedByPlayersDesc()
Sorts the current query's worlds by their player counts in descending order.This method modifies the query to sort the worlds such that the worlds with higher player counts appear earlier in the resulting sequence. The comparison is based on the raw player count value retrieved for each world.
- Returns:
- A
WorldQueryobject sorted by player counts in descending order.
-
sortedByWorldNumberDesc
public WorldQuery sortedByWorldNumberDesc()
Sorts the current query's worlds by their world numbers in descending order.This method modifies the query to sort the worlds such that the worlds with higher world numbers appear earlier in the resulting sequence. The comparison is based on the @getId method of each world, which retrieves the world's numerical ID.
- Returns:
- A
WorldQueryobject sorted by world numbers in descending order.
-
sortByWorldNumberAsc
public WorldQuery sortByWorldNumberAsc()
Sorts the query results in ascending order based on the world number (ID).This method arranges all queried World objects such that the objects with lower world numbers (IDs) appear before those with higher world numbers.
Note: The comparison uses the Integer.compare method to determine the ordering of the world numbers.
- Returns:
- A
WorldQueryobject representing the current state of the query, sorted by world number in ascending order.
-
nonSkillTotalWorlds
public WorldQuery nonSkillTotalWorlds()
Retrieves a query for worlds that exclude the SKILL_TOTAL type.This method creates a query to filter out worlds that are categorized as SKILL_TOTAL, allowing only other world types to be included in the result.
- Returns:
- a
WorldQueryinstance that excludes worlds of type SKILL_TOTAL.
-
nonPvp
public WorldQuery nonPvp()
Filters the query to exclude worlds of thePVPtype.This method refines the results to only include worlds that are not categorized as
PVP, using the internal mechanism to specify exclusion criteria.- Returns:
- A
WorldQueryinstance with thePVPworld type excluded from the query results.
-
standard
public WorldQuery standard()
Configures and returns aWorldQueryobject that excludes specific world types which are not part of the "standard" main game world category. This will filter out worlds like fresh start, deadman, seasonal, leagues, gridmaster etc...The following world types will be excluded:
- @WorldType.PVP_ARENA
- @WorldType.PVP
- @WorldType.QUEST_SPEEDRUNNING
- @WorldType.BETA_WORLD
- @WorldType.LEGACY_ONLY
- @WorldType.EOC_ONLY
- @WorldType.NOSAVE_MODE
- @WorldType.FRESH_START_WORLD
- @WorldType.DEADMAN
- @WorldType.SEASONAL
- Returns:
- A
WorldQueryobject that specifically excludes the listed world types.
-
next
public WorldEntity next()
Retrieves the next WorldEntity in the sorted list whose world ID is greater than the current world ID. If no such entity exists, the method returns the first WorldEntity in the list. If the list is empty, it returnsnull.This method sorts the available WorldEntity objects in ascending order by their world ID and selects the first one with an ID greater than the current world ID as determined by the client's state.
- Returns:
- The next WorldEntity with a world ID greater than the current world ID,
the first WorldEntity in the list if no ID is greater,
or
nullif the list is empty.
-
previous
public WorldEntity previous()
Retrieves the previous World in the sorted list of worlds based on the current world number. The worlds are sorted in ascending order by their world number.If a world with a smaller number than the current world is found, it is returned. Otherwise, the last world in the sorted list is returned. If the list of worlds is empty,
nullis returned.- Returns:
- the previous World in the sorted list, the last World if no
smaller world exists, or
nullif the world list is empty.
-
-