Class WorldQuery

    • Constructor Detail

      • WorldQuery

        public WorldQuery​(Context ctx)
    • Method Detail

      • withName

        public WorldQuery withName​(java.lang.String name)
        Description copied from class: AbstractQuery
        Filters for only entities whose name matches the provided name. This is case-insensitive.
        Overrides:
        withName in class AbstractQuery<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: AbstractQuery
        Filters for entities whose name contains the substring or a portion of the name parameter.
        Overrides:
        nameContains in class AbstractQuery<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 the WorldType.MEMBERS tag.

        Returns:
        A WorldQuery object 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 WorldQuery object 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 specified WorldType values.

        This method modifies the query to include worlds where their list of types contains at least one of the provided WorldType values. If the world's types are null, it will be excluded from the filtered results.

        Parameters:
        types - An array of WorldType values to filter worlds by. Only worlds containing one or more of the specified types will be included in the results.
        Returns:
        A WorldQuery object 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 types parameter.

        Parameters:
        types - an array of @WorldType that specifies the types to exclude from the query. If null or 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.
        If these conditions are not met for a world, it is excluded from the results.
        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 WorldQuery object 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.
        Worlds that do not meet these conditions, or those with invalid or missing activity information, are excluded from the results.
        Returns:
        A WorldQuery object 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 WorldQuery object 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 WorldRegion values. If the world's region is null, it will be excluded from the filtered results.

        Parameters:
        region - An array of WorldRegion values to filter worlds by. Only worlds belonging to one or more of the specified regions will be included in the results.
        Returns:
        A WorldQuery object 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 WorldQuery object 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 count value.

        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 WorldQuery object 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 WorldQuery object 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 WorldQuery object 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 WorldQuery object 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 WorldQuery instance that excludes worlds of type SKILL_TOTAL.
      • nonPvp

        public WorldQuery nonPvp()
        Filters the query to exclude worlds of the PVP type.

        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 WorldQuery instance with the PVP world type excluded from the query results.
      • standard

        public WorldQuery standard()
        Configures and returns a WorldQuery object 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 WorldQuery object 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 returns null.

        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 null if 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, null is returned.

        Returns:
        the previous World in the sorted list, the last World if no smaller world exists, or null if the world list is empty.