api: refactor to use NameableContainer
This uses a nameable container for the friends and ignore lists, and provides the clan manager which inherits from it
This commit is contained in:
@@ -29,13 +29,6 @@ package net.runelite.api;
|
||||
*/
|
||||
public interface ClanMember extends ChatPlayer
|
||||
{
|
||||
/**
|
||||
* Gets the username of the member.
|
||||
*
|
||||
* @return the username
|
||||
*/
|
||||
String getUsername();
|
||||
|
||||
/**
|
||||
* Gets the world the member is in.
|
||||
*
|
||||
|
||||
@@ -24,9 +24,19 @@
|
||||
*/
|
||||
package net.runelite.api;
|
||||
|
||||
/**
|
||||
* Represents the friend and ignore list manager.
|
||||
*/
|
||||
public interface FriendManager
|
||||
public interface ClanMemberManager extends NameableContainer<ClanMember>
|
||||
{
|
||||
/**
|
||||
* Gets the clan owner of the currently joined clan chat
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getClanOwner();
|
||||
|
||||
/**
|
||||
* Gets the clan chat name of the currently joined clan chat
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getClanChatName();
|
||||
}
|
||||
@@ -1111,68 +1111,26 @@ public interface Client extends GameEngine
|
||||
boolean isFriended(String name, boolean mustBeLoggedIn);
|
||||
|
||||
/**
|
||||
* Gets the number of players in the clan chat.
|
||||
*
|
||||
* @return the number of clan chat members
|
||||
*/
|
||||
int getClanChatCount();
|
||||
|
||||
/**
|
||||
* Gets an array of players in the clan chat.
|
||||
*
|
||||
* @return the clan chat members, null if not in a clan
|
||||
*/
|
||||
ClanMember[] getClanMembers();
|
||||
|
||||
/**
|
||||
* Gets the clan owner of the currently joined clan chat
|
||||
* Retrieve the clan member manager
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getClanOwner();
|
||||
@Nullable
|
||||
ClanMemberManager getClanMemberManager();
|
||||
|
||||
/**
|
||||
* Gets the clan chat name of the currently joined clan chat
|
||||
* Retrieve the nameable container containing friends
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getClanChatName();
|
||||
NameableContainer<Friend> getFriendContainer();
|
||||
|
||||
/**
|
||||
* Gets an array of players in the friends list.
|
||||
*
|
||||
* @return the friends list
|
||||
*/
|
||||
Friend[] getFriends();
|
||||
|
||||
/**
|
||||
* Gets the number of friends on the friends list.
|
||||
* Retrieve the nameable container containing ignores
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getFriendsCount();
|
||||
|
||||
/**
|
||||
* Gets an array of players on the ignore list.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Ignore[] getIgnores();
|
||||
|
||||
/**
|
||||
* Gets the number of ignored players on the ignore list.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getIgnoreCount();
|
||||
|
||||
/**
|
||||
* Checks whether a player is in the same clan chat.
|
||||
*
|
||||
* @param name the name of the player
|
||||
* @return true if the player is in clan chat
|
||||
*/
|
||||
boolean isClanMember(String name);
|
||||
NameableContainer<Ignore> getIgnoreContainer();
|
||||
|
||||
/**
|
||||
* Gets the clients saved preferences.
|
||||
|
||||
@@ -29,17 +29,4 @@ package net.runelite.api;
|
||||
*/
|
||||
public interface Friend extends ChatPlayer
|
||||
{
|
||||
/**
|
||||
* The name of the player.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* The previous name the player had.
|
||||
*
|
||||
* @return the previous name
|
||||
*/
|
||||
String getPrevName();
|
||||
}
|
||||
|
||||
@@ -29,17 +29,4 @@ package net.runelite.api;
|
||||
*/
|
||||
public interface Ignore extends Nameable
|
||||
{
|
||||
/**
|
||||
* The name of the player.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* The previous name the player had.
|
||||
*
|
||||
* @return the previous name
|
||||
*/
|
||||
String getPrevName();
|
||||
}
|
||||
|
||||
@@ -29,4 +29,17 @@ package net.runelite.api;
|
||||
*/
|
||||
public interface Nameable extends Comparable
|
||||
{
|
||||
/**
|
||||
* The name of the player.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* The previous name the player had.
|
||||
*
|
||||
* @return the previous name
|
||||
*/
|
||||
String getPrevName();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.api;
|
||||
|
||||
public interface NameableContainer<T extends Nameable>
|
||||
{
|
||||
/**
|
||||
* Get the number of members in this container
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getCount();
|
||||
|
||||
/**
|
||||
* Get the members in this container
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
T[] getMembers();
|
||||
|
||||
/**
|
||||
* Find a nameable by name
|
||||
*
|
||||
* @param name the name
|
||||
* @return
|
||||
*/
|
||||
T findByName(String name);
|
||||
}
|
||||
Reference in New Issue
Block a user