Class Friends


  • public class Friends
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Friends​(KSContext ctx)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.lang.String name)
      Adds a friend by opening the "Add Friend" widget and typing the name.
      boolean isAdded​(java.lang.String name)
      Checks if a friend with the given name is in the friend list.
      boolean isOnline​(java.lang.String name)
      Checks if a friend with the given name is currently online.
      boolean isOnline​(net.runelite.api.Friend friend)
      Checks if the specified Friend object is online.
      FriendQuery query()
      Returns a FriendQuery object to filter and search friends.
      void remove​(java.lang.String name)
      Removes a friend by opening the "Del Friend" widget and typing the name.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Friends

        public Friends​(KSContext ctx)
        Constructor.
        Parameters:
        ctx - KSContext instance for accessing widgets, keyboard, dialogs, and logging.
    • Method Detail

      • query

        public FriendQuery query()
        Returns a FriendQuery object to filter and search friends. Updates the cached friend list only if the game tick has advanced since last query.
        Returns:
        FriendQuery containing the cached list of friends.
      • isAdded

        public boolean isAdded​(java.lang.String name)
        Checks if a friend with the given name is in the friend list.
        Parameters:
        name - Friend name to check.
        Returns:
        true if friend is added, false otherwise.
      • isOnline

        public boolean isOnline​(net.runelite.api.Friend friend)
        Checks if the specified Friend object is online.
        Parameters:
        friend - Friend object to check.
        Returns:
        true if online, false if offline or null.
      • isOnline

        public boolean isOnline​(java.lang.String name)
        Checks if a friend with the given name is currently online.
        Parameters:
        name - Friend name.
        Returns:
        true if online, false otherwise.
      • add

        public void add​(java.lang.String name)
        Adds a friend by opening the "Add Friend" widget and typing the name. Waits for the enter-name dialog and types the name smoothly.
        Parameters:
        name - Name of the friend to add.
      • remove

        public void remove​(java.lang.String name)
        Removes a friend by opening the "Del Friend" widget and typing the name. Waits for the enter-name dialog and types the name smoothly.
        Parameters:
        name - Name of the friend to remove.