Add Ignore API
This commit is contained in:
@@ -1027,6 +1027,20 @@ public interface Client extends GameEngine
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
||||
45
runelite-api/src/main/java/net/runelite/api/Ignore.java
Normal file
45
runelite-api/src/main/java/net/runelite/api/Ignore.java
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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;
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
@@ -37,6 +37,7 @@ import net.runelite.api.GrandExchangeOffer;
|
||||
import net.runelite.api.GraphicsObject;
|
||||
import net.runelite.api.HashTable;
|
||||
import net.runelite.api.HintArrowType;
|
||||
import net.runelite.api.Ignore;
|
||||
import net.runelite.api.IndexedSprite;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.MenuAction;
|
||||
@@ -101,6 +102,7 @@ import net.runelite.rs.api.RSDeque;
|
||||
import net.runelite.rs.api.RSFriendContainer;
|
||||
import net.runelite.rs.api.RSFriendManager;
|
||||
import net.runelite.rs.api.RSHashTable;
|
||||
import net.runelite.rs.api.RSIgnoreContainer;
|
||||
import net.runelite.rs.api.RSIndexedSprite;
|
||||
import net.runelite.rs.api.RSItem;
|
||||
import net.runelite.rs.api.RSItemContainer;
|
||||
@@ -704,6 +706,45 @@ public abstract class RSClientMixin implements RSClient
|
||||
return friendContainer.getCount();
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Ignore[] getIgnores()
|
||||
{
|
||||
final RSFriendManager friendManager = getFriendManager();
|
||||
if (friendManager == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final RSIgnoreContainer ignoreContainer = friendManager.getIgnoreContainer();
|
||||
if (ignoreContainer == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
RSNameable[] nameables = ignoreContainer.getNameables();
|
||||
return (Ignore[]) nameables;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public int getIgnoreCount()
|
||||
{
|
||||
final RSFriendManager friendManager = getFriendManager();
|
||||
if (friendManager == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
final RSIgnoreContainer ignoreContainer = friendManager.getIgnoreContainer();
|
||||
if (ignoreContainer == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ignoreContainer.getCount();
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public boolean isClanMember(String name)
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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.mixins;
|
||||
|
||||
import net.runelite.api.mixins.Inject;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.rs.api.RSIgnore;
|
||||
import net.runelite.rs.api.RSName;
|
||||
|
||||
@Mixin(RSIgnore.class)
|
||||
public abstract class RSIgnoreMixin implements RSIgnore
|
||||
{
|
||||
@Override
|
||||
@Inject
|
||||
public String getName()
|
||||
{
|
||||
return getRsName().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Inject
|
||||
public String getPrevName()
|
||||
{
|
||||
RSName prevName = getRsPrevName();
|
||||
return prevName == null ? null : prevName.getName();
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,9 @@ public interface RSFriendManager extends FriendManager
|
||||
@Import("friendContainer")
|
||||
RSFriendContainer getFriendContainer();
|
||||
|
||||
@Import("ignoreContainer")
|
||||
RSIgnoreContainer getIgnoreContainer();
|
||||
|
||||
@Import("isFriended")
|
||||
boolean isFriended(RSName var1, boolean var2);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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.rs.api;
|
||||
|
||||
import net.runelite.api.Ignore;
|
||||
|
||||
public interface RSIgnore extends Ignore, RSNameable
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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.rs.api;
|
||||
|
||||
public interface RSIgnoreContainer extends RSNameableContainer
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user