runelite-api: add method for getting number of friends

This commit is contained in:
Adam
2018-08-24 20:24:40 -04:00
parent dce458ea9e
commit 962d5d7827
2 changed files with 26 additions and 0 deletions

View File

@@ -1020,6 +1020,13 @@ public interface Client extends GameEngine
*/
Friend[] getFriends();
/**
* Gets the number of friends on the friends list.
*
* @return
*/
int getFriendsCount();
/**
* Checks whether a player is in the same clan chat.
*

View File

@@ -685,6 +685,25 @@ public abstract class RSClientMixin implements RSClient
return (Friend[]) nameables;
}
@Inject
@Override
public int getFriendsCount()
{
final RSFriendManager friendManager = getFriendManager();
if (friendManager == null)
{
return -1;
}
final RSFriendContainer friendContainer = friendManager.getFriendContainer();
if (friendContainer == null)
{
return -1;
}
return friendContainer.getCount();
}
@Inject
@Override
public boolean isClanMember(String name)