Package net.storm.sdk.widgets
Class Friends
java.lang.Object
net.storm.sdk.widgets.Friends
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic List<net.runelite.api.Friend> getAll(int... worlds) Retrieves all friends on the specified worlds.static List<net.runelite.api.Friend> Retrieves all friends with the specified names.static List<net.runelite.api.Friend> Retrieves all friends matching the specified filter.static net.runelite.api.FriendgetFirst(int... worlds) Retrieves the first friend on one of the specified worlds.static net.runelite.api.FriendRetrieves the first friend with one of the specified names.static net.runelite.api.FriendRetrieves the first friend matching the specified filter.static booleanChecks whether a player with the specified name is on the friends list.static booleanChecks whether a friend with the specified name is currently online.static booleanisOnline(net.runelite.api.Friend friend) Checks whether the specified friend is currently online.
-
Constructor Details
-
Friends
public Friends()
-
-
Method Details
-
getAll
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
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
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
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
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
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
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
-