mixins: refactor to use NameableContainer

This commit is contained in:
Owain van Brakel
2020-05-23 03:21:20 +02:00
parent 952fe24a03
commit ad1b7b8a0c
20 changed files with 135 additions and 264 deletions

View File

@@ -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.
*

View File

@@ -27,4 +27,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();
}

View File

@@ -1195,58 +1195,20 @@ public interface Client extends GameShell
boolean isFriended(String name, boolean mustBeLoggedIn);
/**
* Gets the number of players in the clan chat.
*
* @return the number of clan chat members
* Retrieve the clan member manager
*/
int getClanChatCount();
@Nullable
ClanMemberManager getClanMemberManager();
/**
* Gets an array of players in the clan chat.
*
* @return the clan chat members, null if not in a clan
* Retrieve the nameable container containing friends
*/
ClanMember[] getClanMembers();
NameableContainer<Friend> getFriendContainer();
/**
* Gets the clan owner of the currently joined clan chat
* Retrieve the nameable container containing ignores
*/
String getClanOwner();
/**
* Gets the clan chat name of the currently joined clan chat
*/
String getClanChatName();
/**
* Gets an array of players in the friends list.
*
* @return the friends list
*/
Friend[] getFriends();
/**
* Gets the number of friends on the friends list.
*/
int getFriendsCount();
/**
* Gets an array of players on the ignore list.
*/
Ignore[] getIgnores();
/**
* Gets the number of ignored players on the ignore list.
*/
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.

View File

@@ -27,19 +27,4 @@ package net.runelite.api;
/**
* Represents a player in the friends list.
*/
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();
}
public interface Friend extends ChatPlayer {}

View File

@@ -27,19 +27,4 @@ package net.runelite.api;
/**
* An entry on the ignore list.
*/
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();
}
public interface Ignore extends Nameable {}

View File

@@ -27,4 +27,19 @@ package net.runelite.api;
/**
* Represents a chat entity that has a name.
*/
public interface Nameable extends Comparable {}
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();
}

View File

@@ -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);
}