Class Friends

java.lang.Object
net.storm.sdk.widgets.Friends

public class Friends extends Object
Provides utility methods for interacting with the friends list.

This class allows querying the player's friends list, checking friend status, and retrieving friend information. Friends can be filtered by name, world, or custom predicates.

Example Usage:


 // Check if a specific friend is added
 if (Friends.isAdded("PlayerName")) {
     // Check if they're online
     if (Friends.isOnline("PlayerName")) {
         Friend friend = Friends.getFirst("PlayerName");
         int world = friend.getWorld();
     }
 }

 // Get all online friends
 List<Friend> onlineFriends = Friends.getAll(friend -> Friends.isOnline(friend));

 // Get friends on specific worlds
 List<Friend> worldFriends = Friends.getAll(301, 302, 303);
 
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<net.runelite.api.Friend>
    getAll(int... worlds)
    Retrieves all friends on the specified worlds.
    static List<net.runelite.api.Friend>
    getAll(String... names)
    Retrieves all friends with the specified names.
    static List<net.runelite.api.Friend>
    getAll(Predicate<net.runelite.api.Friend> filter)
    Retrieves all friends matching the specified filter.
    static net.runelite.api.Friend
    getFirst(int... worlds)
    Retrieves the first friend on one of the specified worlds.
    static net.runelite.api.Friend
    getFirst(String... names)
    Retrieves the first friend with one of the specified names.
    static net.runelite.api.Friend
    getFirst(Predicate<net.runelite.api.Friend> filter)
    Retrieves the first friend matching the specified filter.
    static boolean
    Checks whether a player with the specified name is on the friends list.
    static boolean
    Checks whether a friend with the specified name is currently online.
    static boolean
    isOnline(net.runelite.api.Friend friend)
    Checks whether the specified friend is currently online.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Friends

      public Friends()
  • Method Details

    • getAll

      public static List<net.runelite.api.Friend> getAll(Predicate<net.runelite.api.Friend> filter)
      Retrieves all friends matching the specified filter.
      Parameters:
      filter - a predicate to filter friends
      Returns:
      a list of friends matching the filter, or an empty list if none match
    • getAll

      public static List<net.runelite.api.Friend> getAll(String... names)
      Retrieves all friends with the specified names.
      Parameters:
      names - the friend names to search for
      Returns:
      a list of friends with matching names, or an empty list if none found
    • getAll

      public static List<net.runelite.api.Friend> getAll(int... worlds)
      Retrieves all friends on the specified worlds.
      Parameters:
      worlds - the world numbers to filter by
      Returns:
      a list of friends on the specified worlds, or an empty list if none found
    • getFirst

      public static net.runelite.api.Friend getFirst(Predicate<net.runelite.api.Friend> filter)
      Retrieves the first friend matching the specified filter.
      Parameters:
      filter - a predicate to filter friends
      Returns:
      the first matching friend, or null if none match
    • getFirst

      public static net.runelite.api.Friend getFirst(String... names)
      Retrieves the first friend with one of the specified names.
      Parameters:
      names - the friend names to search for
      Returns:
      the first matching friend, or null if none found
    • getFirst

      public static net.runelite.api.Friend getFirst(int... worlds)
      Retrieves the first friend on one of the specified worlds.
      Parameters:
      worlds - the world numbers to filter by
      Returns:
      the first matching friend, or null if none found
    • isAdded

      public static boolean isAdded(String name)
      Checks whether a player with the specified name is on the friends list.
      Parameters:
      name - the name to check
      Returns:
      true if the player is on the friends list, false otherwise
    • isOnline

      public static boolean isOnline(net.runelite.api.Friend friend)
      Checks whether the specified friend is currently online.
      Parameters:
      friend - the friend to check
      Returns:
      true if the friend is online, false otherwise
    • isOnline

      public static boolean isOnline(String name)
      Checks whether a friend with the specified name is currently online.
      Parameters:
      name - the friend's name to check
      Returns:
      true if the friend is online, false otherwise