Rename clan chat to friends chat
This commit is contained in:
@@ -56,7 +56,7 @@ import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.discord.DiscordService;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.externalplugins.ExternalPluginManager;
|
||||
import net.runelite.client.game.ClanManager;
|
||||
import net.runelite.client.game.FriendChatManager;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.game.LootManager;
|
||||
import net.runelite.client.game.chatbox.ChatboxPanelManager;
|
||||
@@ -137,7 +137,7 @@ public class RuneLite
|
||||
private Provider<OverlayRenderer> overlayRenderer;
|
||||
|
||||
@Inject
|
||||
private Provider<ClanManager> clanManager;
|
||||
private Provider<FriendChatManager> friendsChatManager;
|
||||
|
||||
@Inject
|
||||
private Provider<ChatMessageManager> chatMessageManager;
|
||||
@@ -347,7 +347,7 @@ public class RuneLite
|
||||
|
||||
eventBus.register(partyService.get());
|
||||
eventBus.register(overlayRenderer.get());
|
||||
eventBus.register(clanManager.get());
|
||||
eventBus.register(friendsChatManager.get());
|
||||
eventBus.register(itemManager.get());
|
||||
eventBus.register(menuManager.get());
|
||||
eventBus.register(chatMessageManager.get());
|
||||
|
||||
@@ -133,7 +133,7 @@ public class ChatCommandManager implements ChatboxInputListener
|
||||
String message = chatboxInput.getValue();
|
||||
if (message.startsWith("/"))
|
||||
{
|
||||
message = message.substring(1); // clan chat input
|
||||
message = message.substring(1); // friends chat input
|
||||
}
|
||||
|
||||
String command = extractCommand(message);
|
||||
|
||||
@@ -139,11 +139,11 @@ public class ChatMessageManager
|
||||
break;
|
||||
}
|
||||
case FRIENDSCHAT:
|
||||
usernameColor = isChatboxTransparent ? chatColorConfig.transparentClanUsernames() : chatColorConfig.opaqueClanUsernames();
|
||||
usernameColor = isChatboxTransparent ? chatColorConfig.transparentFriendsChatUsernames() : chatColorConfig.opaqueFriendsChatUsernames();
|
||||
break;
|
||||
}
|
||||
|
||||
senderColor = isChatboxTransparent ? chatColorConfig.transparentClanChannelName() : chatColorConfig.opaqueClanChannelName();
|
||||
senderColor = isChatboxTransparent ? chatColorConfig.transparentFriendsChatChannelName() : chatColorConfig.opaqueFriendsChatChannelName();
|
||||
|
||||
if (usernameColor != null)
|
||||
{
|
||||
@@ -218,7 +218,7 @@ public class ChatMessageManager
|
||||
case PRIVATECHAT:
|
||||
return JagexColors.CHAT_PRIVATE_MESSAGE_TEXT_OPAQUE_BACKGROUND;
|
||||
case FRIENDSCHAT:
|
||||
return JagexColors.CHAT_CLAN_TEXT_OPAQUE_BACKGROUND;
|
||||
return JagexColors.CHAT_FC_TEXT_OPAQUE_BACKGROUND;
|
||||
case ITEM_EXAMINE:
|
||||
case OBJECT_EXAMINE:
|
||||
case NPC_EXAMINE:
|
||||
@@ -238,7 +238,7 @@ public class ChatMessageManager
|
||||
case PRIVATECHAT:
|
||||
return JagexColors.CHAT_PRIVATE_MESSAGE_TEXT_TRANSPARENT_BACKGROUND;
|
||||
case FRIENDSCHAT:
|
||||
return JagexColors.CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND;
|
||||
return JagexColors.CHAT_FC_TEXT_TRANSPARENT_BACKGROUND;
|
||||
case ITEM_EXAMINE:
|
||||
case OBJECT_EXAMINE:
|
||||
case NPC_EXAMINE:
|
||||
@@ -311,24 +311,24 @@ public class ChatMessageManager
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaquePrivateMessageReceivedHighlight(), false),
|
||||
ChatMessageType.MODPRIVATECHAT);
|
||||
}
|
||||
if (chatColorConfig.opaqueClanChatInfo() != null)
|
||||
if (chatColorConfig.opaqueFriendsChatInfo() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueClanChatInfo(), false),
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueFriendsChatInfo(), false),
|
||||
ChatMessageType.FRIENDSCHATNOTIFICATION);
|
||||
}
|
||||
if (chatColorConfig.opaqueClanChatInfoHighlight() != null)
|
||||
if (chatColorConfig.opaqueFriendsChatInfoHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueClanChatInfoHighlight(), false),
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueFriendsChatInfoHighlight(), false),
|
||||
ChatMessageType.FRIENDSCHATNOTIFICATION);
|
||||
}
|
||||
if (chatColorConfig.opaqueClanChatMessage() != null)
|
||||
if (chatColorConfig.opaqueFriendsChatMessage() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueClanChatMessage(), false),
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueFriendsChatMessage(), false),
|
||||
ChatMessageType.FRIENDSCHAT);
|
||||
}
|
||||
if (chatColorConfig.opaqueClanChatMessageHighlight() != null)
|
||||
if (chatColorConfig.opaqueFriendsChatMessageHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueClanChatMessageHighlight(), false),
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueFriendsChatMessageHighlight(), false),
|
||||
ChatMessageType.FRIENDSCHAT);
|
||||
}
|
||||
if (chatColorConfig.opaqueAutochatMessage() != null)
|
||||
@@ -444,24 +444,24 @@ public class ChatMessageManager
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentPrivateMessageReceivedHighlight(), true),
|
||||
ChatMessageType.MODPRIVATECHAT);
|
||||
}
|
||||
if (chatColorConfig.transparentClanChatInfo() != null)
|
||||
if (chatColorConfig.transparentFriendsChatInfo() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentClanChatInfo(), true),
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentFriendsChatInfo(), true),
|
||||
ChatMessageType.FRIENDSCHATNOTIFICATION);
|
||||
}
|
||||
if (chatColorConfig.transparentClanChatInfoHighlight() != null)
|
||||
if (chatColorConfig.transparentFriendsChatInfoHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentClanChatInfoHighlight(), true),
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentFriendsChatInfoHighlight(), true),
|
||||
ChatMessageType.FRIENDSCHATNOTIFICATION);
|
||||
}
|
||||
if (chatColorConfig.transparentClanChatMessage() != null)
|
||||
if (chatColorConfig.transparentFriendsChatMessage() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentClanChatMessage(), true),
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentFriendsChatMessage(), true),
|
||||
ChatMessageType.FRIENDSCHAT);
|
||||
}
|
||||
if (chatColorConfig.transparentClanChatMessageHighlight() != null)
|
||||
if (chatColorConfig.transparentFriendsChatMessageHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentClanChatMessageHighlight(), true),
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentFriendsChatMessageHighlight(), true),
|
||||
ChatMessageType.FRIENDSCHAT);
|
||||
}
|
||||
if (chatColorConfig.transparentAutochatMessage() != null)
|
||||
|
||||
@@ -112,11 +112,11 @@ public interface ChatColorConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
keyName = "opaqueClanChatInfo",
|
||||
name = "Clan chat info",
|
||||
description = "Clan Chat Information (eg. when joining a channel)",
|
||||
name = "Friends chat info",
|
||||
description = "Friends Chat Information (eg. when joining a channel)",
|
||||
section = opaqueSection
|
||||
)
|
||||
default Color opaqueClanChatInfo()
|
||||
default Color opaqueFriendsChatInfo()
|
||||
{
|
||||
return JagexColors.CHAT_GAME_EXAMINE_TEXT_OPAQUE_BACKGROUND;
|
||||
}
|
||||
@@ -124,11 +124,11 @@ public interface ChatColorConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "opaqueClanChatInfoHighlight",
|
||||
name = "Clan chat info highlight",
|
||||
description = "Clan Chat Information highlight (used for the Raids plugin)",
|
||||
name = "Friends chat info highlight",
|
||||
description = "Friends Chat Information highlight (used for the Raids plugin)",
|
||||
section = opaqueSection
|
||||
)
|
||||
default Color opaqueClanChatInfoHighlight()
|
||||
default Color opaqueFriendsChatInfoHighlight()
|
||||
{
|
||||
return Color.RED;
|
||||
}
|
||||
@@ -136,20 +136,20 @@ public interface ChatColorConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 9,
|
||||
keyName = "opaqueClanChatMessage",
|
||||
name = "Clan chat message",
|
||||
description = "Color of Clan Chat Messages",
|
||||
name = "Friends chat message",
|
||||
description = "Color of Friends chat messages",
|
||||
section = opaqueSection
|
||||
)
|
||||
Color opaqueClanChatMessage();
|
||||
Color opaqueFriendsChatMessage();
|
||||
|
||||
@ConfigItem(
|
||||
position = 10,
|
||||
keyName = "opaqueClanChatMessageHighlight",
|
||||
name = "Clan chat message highlight",
|
||||
description = "Color of highlights in Clan Chat Messages",
|
||||
name = "Friends chat message highlight",
|
||||
description = "Color of highlights in Friends Chat messages",
|
||||
section = opaqueSection
|
||||
)
|
||||
default Color opaqueClanChatMessageHighlight()
|
||||
default Color opaqueFriendsChatMessageHighlight()
|
||||
{
|
||||
return Color.decode("#000000");
|
||||
}
|
||||
@@ -289,20 +289,20 @@ public interface ChatColorConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 25,
|
||||
keyName = "opaqueClanChannelName",
|
||||
name = "Clan channel name",
|
||||
description = "Color of Clan Channel Name",
|
||||
name = "Friends chat channel name",
|
||||
description = "Color of Friends chat channel name",
|
||||
section = opaqueSection
|
||||
)
|
||||
Color opaqueClanChannelName();
|
||||
Color opaqueFriendsChatChannelName();
|
||||
|
||||
@ConfigItem(
|
||||
position = 26,
|
||||
keyName = "opaqueClanUsernames",
|
||||
name = "Clan usernames",
|
||||
description = "Color of Usernames in Clan Chat",
|
||||
name = "Friends chat usernames",
|
||||
description = "Color of usernames in Friends chat",
|
||||
section = opaqueSection
|
||||
)
|
||||
Color opaqueClanUsernames();
|
||||
Color opaqueFriendsChatUsernames();
|
||||
|
||||
@ConfigItem(
|
||||
position = 27,
|
||||
@@ -379,11 +379,11 @@ public interface ChatColorConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 57,
|
||||
keyName = "transparentClanChatInfo",
|
||||
name = "Clan chat info (transparent)",
|
||||
description = "Clan Chat Information (eg. when joining a channel) (transparent)",
|
||||
name = "Friends chat info (transparent)",
|
||||
description = "Friends chat information (eg. when joining a channel) (transparent)",
|
||||
section = transparentSection
|
||||
)
|
||||
default Color transparentClanChatInfo()
|
||||
default Color transparentFriendsChatInfo()
|
||||
{
|
||||
return JagexColors.CHAT_GAME_EXAMINE_TEXT_TRANSPARENT_BACKGROUND;
|
||||
}
|
||||
@@ -391,11 +391,11 @@ public interface ChatColorConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 58,
|
||||
keyName = "transparentClanChatInfoHighlight",
|
||||
name = "Clan chat info highlight (transparent)",
|
||||
description = "Clan Chat Information highlight (used for the Raids plugin) (transparent)",
|
||||
name = "Friends chat info highlight (transparent)",
|
||||
description = "Friends chat information highlight (used for the Raids plugin) (transparent)",
|
||||
section = transparentSection
|
||||
)
|
||||
default Color transparentClanChatInfoHighlight()
|
||||
default Color transparentFriendsChatInfoHighlight()
|
||||
{
|
||||
return Color.RED;
|
||||
}
|
||||
@@ -403,20 +403,20 @@ public interface ChatColorConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 59,
|
||||
keyName = "transparentClanChatMessage",
|
||||
name = "Clan chat message (transparent)",
|
||||
description = "Color of Clan Chat Messages (transparent)",
|
||||
name = "Friends chat message (transparent)",
|
||||
description = "Color of Friends chat messages (transparent)",
|
||||
section = transparentSection
|
||||
)
|
||||
Color transparentClanChatMessage();
|
||||
Color transparentFriendsChatMessage();
|
||||
|
||||
@ConfigItem(
|
||||
position = 60,
|
||||
keyName = "transparentClanChatMessageHighlight",
|
||||
name = "Clan chat message highlight (transparent)",
|
||||
description = "Color of highlights in Clan Chat Messages (transparent)",
|
||||
name = "Friends chat message highlight (transparent)",
|
||||
description = "Color of highlights in Friends chat messages (transparent)",
|
||||
section = transparentSection
|
||||
)
|
||||
default Color transparentClanChatMessageHighlight()
|
||||
default Color transparentFriendsChatMessageHighlight()
|
||||
{
|
||||
return Color.decode("#FFFFFF");
|
||||
}
|
||||
@@ -556,20 +556,20 @@ public interface ChatColorConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 75,
|
||||
keyName = "transparentClanChannelName",
|
||||
name = "Clan channel name (transparent)",
|
||||
description = "Color of Clan Channel Name (transparent)",
|
||||
name = "Friends chat channel name (transparent)",
|
||||
description = "Color of Friends chat channel name (transparent)",
|
||||
section = transparentSection
|
||||
)
|
||||
Color transparentClanChannelName();
|
||||
Color transparentFriendsChatChannelName();
|
||||
|
||||
@ConfigItem(
|
||||
position = 76,
|
||||
keyName = "transparentClanUsernames",
|
||||
name = "Clan usernames (transparent)",
|
||||
description = "Color of Usernames in Clan Chat (transparent)",
|
||||
name = "Friends chat usernames (transparent)",
|
||||
description = "Color of usernames in Friends chat (transparent)",
|
||||
section = transparentSection
|
||||
)
|
||||
Color transparentClanUsernames();
|
||||
Color transparentFriendsChatUsernames();
|
||||
|
||||
@ConfigItem(
|
||||
position = 77,
|
||||
|
||||
@@ -36,94 +36,94 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.ClanMember;
|
||||
import net.runelite.api.ClanMemberManager;
|
||||
import net.runelite.api.ClanMemberRank;
|
||||
import net.runelite.api.FriendsChatMember;
|
||||
import net.runelite.api.FriendsChatManager;
|
||||
import net.runelite.api.FriendsChatRank;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.IndexedSprite;
|
||||
import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.events.ClanChanged;
|
||||
import net.runelite.api.events.FriendsChatChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
@Singleton
|
||||
public class ClanManager
|
||||
public class FriendChatManager
|
||||
{
|
||||
private static final int[] CLANCHAT_IMAGES =
|
||||
private static final int[] RANK_IMAGES =
|
||||
{
|
||||
SpriteID.CLAN_CHAT_RANK_SMILEY_FRIEND,
|
||||
SpriteID.CLAN_CHAT_RANK_SINGLE_CHEVRON_RECRUIT,
|
||||
SpriteID.CLAN_CHAT_RANK_DOUBLE_CHEVRON_CORPORAL,
|
||||
SpriteID.CLAN_CHAT_RANK_TRIPLE_CHEVRON_SERGEANT,
|
||||
SpriteID.CLAN_CHAT_RANK_BRONZE_STAR_LIEUTENANT,
|
||||
SpriteID.CLAN_CHAT_RANK_SILVER_STAR_CAPTAIN,
|
||||
SpriteID.CLAN_CHAT_RANK_GOLD_STAR_GENERAL,
|
||||
SpriteID.CLAN_CHAT_RANK_KEY_CHANNEL_OWNER,
|
||||
SpriteID.CLAN_CHAT_RANK_CROWN_JAGEX_MODERATOR,
|
||||
SpriteID.FRIENDS_CHAT_RANK_SMILEY_FRIEND,
|
||||
SpriteID.FRIENDS_CHAT_RANK_SINGLE_CHEVRON_RECRUIT,
|
||||
SpriteID.FRIENDS_CHAT_RANK_DOUBLE_CHEVRON_CORPORAL,
|
||||
SpriteID.FRIENDS_CHAT_RANK_TRIPLE_CHEVRON_SERGEANT,
|
||||
SpriteID.FRIENDS_CHAT_RANK_BRONZE_STAR_LIEUTENANT,
|
||||
SpriteID.FRIENDS_CHAT_RANK_SILVER_STAR_CAPTAIN,
|
||||
SpriteID.FRIENDS_CHAT_RANK_GOLD_STAR_GENERAL,
|
||||
SpriteID.FRIENDS_CHAT_RANK_KEY_CHANNEL_OWNER,
|
||||
SpriteID.FRIENDS_CHAT_RANK_CROWN_JAGEX_MODERATOR,
|
||||
};
|
||||
private static final Dimension CLANCHAT_IMAGE_DIMENSION = new Dimension(11, 11);
|
||||
private static final Color CLANCHAT_IMAGE_OUTLINE_COLOR = new Color(33, 33, 33);
|
||||
private static final Dimension IMAGE_DIMENSION = new Dimension(11, 11);
|
||||
private static final Color IMAGE_OUTLINE_COLOR = new Color(33, 33, 33);
|
||||
|
||||
private final Client client;
|
||||
private final SpriteManager spriteManager;
|
||||
private final BufferedImage[] clanChatImages = new BufferedImage[CLANCHAT_IMAGES.length];
|
||||
private final BufferedImage[] rankImages = new BufferedImage[RANK_IMAGES.length];
|
||||
|
||||
private final LoadingCache<String, ClanMemberRank> clanRanksCache = CacheBuilder.newBuilder()
|
||||
private final LoadingCache<String, FriendsChatRank> ranksCache = CacheBuilder.newBuilder()
|
||||
.maximumSize(100)
|
||||
.expireAfterWrite(1, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<String, ClanMemberRank>()
|
||||
.build(new CacheLoader<String, FriendsChatRank>()
|
||||
{
|
||||
@Override
|
||||
public ClanMemberRank load(@Nonnull String key)
|
||||
public FriendsChatRank load(@Nonnull String key)
|
||||
{
|
||||
final ClanMemberManager clanMemberManager = client.getClanMemberManager();
|
||||
if (clanMemberManager == null)
|
||||
final FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||
if (friendsChatManager == null)
|
||||
{
|
||||
return ClanMemberRank.UNRANKED;
|
||||
return FriendsChatRank.UNRANKED;
|
||||
}
|
||||
|
||||
ClanMember clanMember = clanMemberManager.findByName(sanitize(key));
|
||||
return clanMember != null ? clanMember.getRank() : ClanMemberRank.UNRANKED;
|
||||
FriendsChatMember friendsChatMember = friendsChatManager.findByName(sanitize(key));
|
||||
return friendsChatMember != null ? friendsChatMember.getRank() : FriendsChatRank.UNRANKED;
|
||||
}
|
||||
});
|
||||
|
||||
private int offset;
|
||||
|
||||
@Inject
|
||||
private ClanManager(Client client, SpriteManager spriteManager)
|
||||
private FriendChatManager(Client client, SpriteManager spriteManager)
|
||||
{
|
||||
this.client = client;
|
||||
this.spriteManager = spriteManager;
|
||||
}
|
||||
|
||||
public boolean isClanMember(String name)
|
||||
public boolean isMember(String name)
|
||||
{
|
||||
ClanMemberManager clanMemberManager = client.getClanMemberManager();
|
||||
return clanMemberManager != null && clanMemberManager.findByName(name) != null;
|
||||
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||
return friendsChatManager != null && friendsChatManager.findByName(name) != null;
|
||||
}
|
||||
|
||||
public ClanMemberRank getRank(String playerName)
|
||||
public FriendsChatRank getRank(String playerName)
|
||||
{
|
||||
return clanRanksCache.getUnchecked(playerName);
|
||||
return ranksCache.getUnchecked(playerName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public BufferedImage getClanImage(final ClanMemberRank clanMemberRank)
|
||||
public BufferedImage getRankImage(final FriendsChatRank friendsChatRank)
|
||||
{
|
||||
if (clanMemberRank == ClanMemberRank.UNRANKED)
|
||||
if (friendsChatRank == FriendsChatRank.UNRANKED)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return clanChatImages[clanMemberRank.ordinal() - 1];
|
||||
return rankImages[friendsChatRank.ordinal() - 1];
|
||||
}
|
||||
|
||||
public int getIconNumber(final ClanMemberRank clanMemberRank)
|
||||
public int getIconNumber(final FriendsChatRank friendsChatRank)
|
||||
{
|
||||
return offset + clanMemberRank.ordinal() - 1;
|
||||
return offset + friendsChatRank.ordinal() - 1;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -131,17 +131,17 @@ public class ClanManager
|
||||
{
|
||||
if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN && offset == 0)
|
||||
{
|
||||
loadClanChatIcons();
|
||||
loadRankIcons();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onClanChanged(ClanChanged clanChanged)
|
||||
public void onFriendsChatChanged(FriendsChatChanged friendsChatChanged)
|
||||
{
|
||||
clanRanksCache.invalidateAll();
|
||||
ranksCache.invalidateAll();
|
||||
}
|
||||
|
||||
private void loadClanChatIcons()
|
||||
private void loadRankIcons()
|
||||
{
|
||||
{
|
||||
IndexedSprite[] modIcons = client.getModIcons();
|
||||
@@ -151,21 +151,21 @@ public class ClanManager
|
||||
new BufferedImage(modIcons[0].getWidth(), modIcons[0].getHeight(), BufferedImage.TYPE_INT_ARGB),
|
||||
client);
|
||||
|
||||
modIcons = Arrays.copyOf(modIcons, offset + CLANCHAT_IMAGES.length);
|
||||
modIcons = Arrays.copyOf(modIcons, offset + RANK_IMAGES.length);
|
||||
Arrays.fill(modIcons, offset, modIcons.length, blank);
|
||||
|
||||
client.setModIcons(modIcons);
|
||||
}
|
||||
|
||||
for (int i = 0; i < CLANCHAT_IMAGES.length; i++)
|
||||
for (int i = 0; i < RANK_IMAGES.length; i++)
|
||||
{
|
||||
final int fi = i;
|
||||
|
||||
spriteManager.getSpriteAsync(CLANCHAT_IMAGES[i], 0, sprite ->
|
||||
spriteManager.getSpriteAsync(RANK_IMAGES[i], 0, sprite ->
|
||||
{
|
||||
IndexedSprite[] modIcons = client.getModIcons();
|
||||
clanChatImages[fi] = clanChatImageFromSprite(sprite);
|
||||
modIcons[offset + fi] = ImageUtil.getImageIndexedSprite(clanChatImages[fi], client);
|
||||
rankImages[fi] = friendsChatImageFromSprite(sprite);
|
||||
modIcons[offset + fi] = ImageUtil.getImageIndexedSprite(rankImages[fi], client);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -176,9 +176,9 @@ public class ClanManager
|
||||
return cleaned.replace('\u00A0', ' ');
|
||||
}
|
||||
|
||||
private static BufferedImage clanChatImageFromSprite(final BufferedImage clanSprite)
|
||||
private static BufferedImage friendsChatImageFromSprite(final BufferedImage sprite)
|
||||
{
|
||||
final BufferedImage clanChatCanvas = ImageUtil.resizeCanvas(clanSprite, CLANCHAT_IMAGE_DIMENSION.width, CLANCHAT_IMAGE_DIMENSION.height);
|
||||
return ImageUtil.outlineImage(clanChatCanvas, CLANCHAT_IMAGE_OUTLINE_COLOR);
|
||||
final BufferedImage canvas = ImageUtil.resizeCanvas(sprite, IMAGE_DIMENSION.width, IMAGE_DIMENSION.height);
|
||||
return ImageUtil.outlineImage(canvas, IMAGE_OUTLINE_COLOR);
|
||||
}
|
||||
}
|
||||
@@ -89,11 +89,11 @@ public interface ChatFilterConfig extends Config
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "filterClan",
|
||||
name = "Filter Clan Chat Members",
|
||||
description = "Filter your clan chat members' messages",
|
||||
name = "Filter Friends Chat Members",
|
||||
description = "Filter your friends chat members' messages",
|
||||
position = 6
|
||||
)
|
||||
default boolean filterClan()
|
||||
default boolean filterFriendsChat()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.game.ClanManager;
|
||||
import net.runelite.client.game.FriendChatManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.util.Text;
|
||||
@@ -118,7 +118,7 @@ public class ChatFilterPlugin extends Plugin
|
||||
private ChatFilterConfig config;
|
||||
|
||||
@Inject
|
||||
private ClanManager clanManager;
|
||||
private FriendChatManager friendChatManager;
|
||||
|
||||
@Provides
|
||||
ChatFilterConfig provideConfig(ConfigManager configManager)
|
||||
@@ -262,7 +262,7 @@ public class ChatFilterPlugin extends Plugin
|
||||
boolean isMessageFromSelf = playerName.equals(client.getLocalPlayer().getName());
|
||||
return !isMessageFromSelf &&
|
||||
(config.filterFriends() || !client.isFriended(playerName, false)) &&
|
||||
(config.filterClan() || !clanManager.isClanMember(playerName));
|
||||
(config.filterFriendsChat() || !friendChatManager.isMember(playerName));
|
||||
}
|
||||
|
||||
String censorMessage(final String username, final String message)
|
||||
|
||||
@@ -68,10 +68,10 @@ public interface EntityHiderConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "hideClanMates",
|
||||
name = "Hide Clan Mates",
|
||||
description = "Configures whether or not clan mates are hidden"
|
||||
name = "Hide Friends Chat members",
|
||||
description = "Configures whether or not friends chat members are hidden"
|
||||
)
|
||||
default boolean hideClanMates()
|
||||
default boolean hideFriendsChatMembers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class EntityHiderPlugin extends Plugin
|
||||
client.setPlayersHidden2D(config.hidePlayers2D());
|
||||
|
||||
client.setFriendsHidden(config.hideFriends());
|
||||
client.setClanMatesHidden(config.hideClanMates());
|
||||
client.setFriendsChatMembersHidden(config.hideFriendsChatMembers());
|
||||
|
||||
client.setLocalPlayerHidden(config.hideLocalPlayer());
|
||||
client.setLocalPlayerHidden2D(config.hideLocalPlayer2D());
|
||||
@@ -111,7 +111,7 @@ public class EntityHiderPlugin extends Plugin
|
||||
client.setPlayersHidden2D(false);
|
||||
|
||||
client.setFriendsHidden(false);
|
||||
client.setClanMatesHidden(false);
|
||||
client.setFriendsChatMembersHidden(false);
|
||||
|
||||
client.setLocalPlayerHidden(false);
|
||||
client.setLocalPlayerHidden2D(false);
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
* (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.client.plugins.clanchat;
|
||||
package net.runelite.client.plugins.friendschat;
|
||||
|
||||
enum ClanActivityType
|
||||
enum ActivityType
|
||||
{
|
||||
JOINED,
|
||||
LEFT
|
||||
@@ -22,24 +22,24 @@
|
||||
* (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.client.plugins.clanchat;
|
||||
package net.runelite.client.plugins.friendschat;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.api.ClanMemberRank;
|
||||
import net.runelite.api.FriendsChatRank;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("clanchat")
|
||||
public interface ClanChatConfig extends Config
|
||||
@ConfigGroup("clanchat") // group name from the old plugin
|
||||
public interface FriendsChatConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "clanChatIcons",
|
||||
name = "Clan Chat Icons",
|
||||
description = "Show clan chat icons next to clan members.",
|
||||
name = "Chat Icons",
|
||||
description = "Show friends chat chat icons next to members.",
|
||||
position = 1
|
||||
)
|
||||
default boolean clanChatIcons()
|
||||
default boolean chatIcons()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public interface ClanChatConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "recentChats",
|
||||
name = "Recent Chats",
|
||||
description = "Show recent clan chats.",
|
||||
description = "Show recent friends chats.",
|
||||
position = 2
|
||||
)
|
||||
default boolean recentChats()
|
||||
@@ -57,11 +57,11 @@ public interface ClanChatConfig extends Config
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "clanCounter",
|
||||
name = "Clan Members Counter",
|
||||
description = "Show the amount of clan members near you.",
|
||||
name = "Members Counter",
|
||||
description = "Show the amount of friends chat members near you.",
|
||||
position = 3
|
||||
)
|
||||
default boolean showClanCounter()
|
||||
default boolean showCounter()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -101,15 +101,15 @@ public interface ClanChatConfig extends Config
|
||||
description = "Only show join/leave messages for members at or above this rank.",
|
||||
position = 5
|
||||
)
|
||||
default ClanMemberRank joinLeaveRank()
|
||||
default FriendsChatRank joinLeaveRank()
|
||||
{
|
||||
return ClanMemberRank.UNRANKED;
|
||||
return FriendsChatRank.UNRANKED;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "privateMessageIcons",
|
||||
name = "Private Message Icons",
|
||||
description = "Add clan chat rank icons to private messages received from clan mates.",
|
||||
description = "Add rank icons to private messages received from members.",
|
||||
position = 6
|
||||
)
|
||||
default boolean privateMessageIcons()
|
||||
@@ -120,7 +120,7 @@ public interface ClanChatConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "publicChatIcons",
|
||||
name = "Public Chat Icons",
|
||||
description = "Add clan chat rank icons to public chat messages from clan mates.",
|
||||
description = "Add rank icons to public chat messages from members.",
|
||||
position = 7
|
||||
)
|
||||
default boolean publicChatIcons()
|
||||
@@ -130,11 +130,11 @@ public interface ClanChatConfig extends Config
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "clanTabChat",
|
||||
name = "Clan Tab Chat",
|
||||
description = "Allows clan chat without prepending '/' to messages when on clan tab",
|
||||
name = "Tab Chat",
|
||||
description = "Allows friends chat chat without prepending '/' to messages when on the friends chat tab",
|
||||
position = 8
|
||||
)
|
||||
default boolean clanTabChat()
|
||||
default boolean friendsChatTabChat()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ public interface ClanChatConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "showIgnoresColor",
|
||||
name = "Ignored color",
|
||||
description = "Allows you to change the color of the ignored players in your clan chat",
|
||||
description = "Allows you to change the color of the ignored players in your friends chat",
|
||||
position = 11
|
||||
)
|
||||
default Color showIgnoresColor()
|
||||
@@ -24,7 +24,7 @@
|
||||
* (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.client.plugins.clanchat;
|
||||
package net.runelite.client.plugins.friendschat;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -42,9 +42,9 @@ import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ChatLineBuffer;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.ClanMember;
|
||||
import net.runelite.api.ClanMemberManager;
|
||||
import net.runelite.api.ClanMemberRank;
|
||||
import net.runelite.api.FriendsChatMember;
|
||||
import net.runelite.api.FriendsChatManager;
|
||||
import net.runelite.api.FriendsChatRank;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Ignore;
|
||||
@@ -56,9 +56,9 @@ import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.VarClientStr;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ClanChanged;
|
||||
import net.runelite.api.events.ClanMemberJoined;
|
||||
import net.runelite.api.events.ClanMemberLeft;
|
||||
import net.runelite.api.events.FriendsChatChanged;
|
||||
import net.runelite.api.events.FriendsChatMemberJoined;
|
||||
import net.runelite.api.events.FriendsChatMemberLeft;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.PlayerDespawned;
|
||||
@@ -74,28 +74,28 @@ import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.game.ClanManager;
|
||||
import net.runelite.client.game.FriendChatManager;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.client.game.chatbox.ChatboxPanelManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import static net.runelite.client.ui.JagexColors.CHAT_CLAN_NAME_OPAQUE_BACKGROUND;
|
||||
import static net.runelite.client.ui.JagexColors.CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND;
|
||||
import static net.runelite.client.ui.JagexColors.CHAT_CLAN_TEXT_OPAQUE_BACKGROUND;
|
||||
import static net.runelite.client.ui.JagexColors.CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND;
|
||||
import static net.runelite.client.ui.JagexColors.CHAT_FC_NAME_OPAQUE_BACKGROUND;
|
||||
import static net.runelite.client.ui.JagexColors.CHAT_FC_NAME_TRANSPARENT_BACKGROUND;
|
||||
import static net.runelite.client.ui.JagexColors.CHAT_FC_TEXT_OPAQUE_BACKGROUND;
|
||||
import static net.runelite.client.ui.JagexColors.CHAT_FC_TEXT_TRANSPARENT_BACKGROUND;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Clan Chat",
|
||||
description = "Add rank icons to users talking in clan chat",
|
||||
tags = {"icons", "rank", "recent"}
|
||||
name = "Friends Chat",
|
||||
description = "Add rank icons to users talking in friends chat",
|
||||
tags = {"icons", "rank", "recent", "clan"}
|
||||
)
|
||||
public class ClanChatPlugin extends Plugin
|
||||
public class FriendsChatPlugin extends Plugin
|
||||
{
|
||||
private static final int MAX_CHATS = 10;
|
||||
private static final String CLAN_CHAT_TITLE = "CC";
|
||||
private static final String RECENT_TITLE = "Recent CCs";
|
||||
private static final String TITLE = "FC";
|
||||
private static final String RECENT_TITLE = "Recent FCs";
|
||||
private static final int JOIN_LEAVE_DURATION = 20;
|
||||
private static final int MESSAGE_DELAY = 10;
|
||||
|
||||
@@ -103,10 +103,10 @@ public class ClanChatPlugin extends Plugin
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ClanManager clanManager;
|
||||
private FriendChatManager friendChatManager;
|
||||
|
||||
@Inject
|
||||
private ClanChatConfig config;
|
||||
private FriendsChatConfig config;
|
||||
|
||||
@Inject
|
||||
private InfoBoxManager infoBoxManager;
|
||||
@@ -121,21 +121,21 @@ public class ClanChatPlugin extends Plugin
|
||||
private ChatboxPanelManager chatboxPanelManager;
|
||||
|
||||
private List<String> chats = new ArrayList<>();
|
||||
private List<Player> clanMembers = new ArrayList<>();
|
||||
private ClanChatIndicator clanMemberCounter;
|
||||
private List<Player> members = new ArrayList<>();
|
||||
private MembersIndicator membersIndicator;
|
||||
/**
|
||||
* queue of temporary messages added to the client
|
||||
*/
|
||||
private final Deque<ClanJoinMessage> clanJoinMessages = new ArrayDeque<>();
|
||||
private Map<String, ClanMemberActivity> activityBuffer = new HashMap<>();
|
||||
private int clanJoinedTick;
|
||||
private final Deque<MemberJoinMessage> joinMessages = new ArrayDeque<>();
|
||||
private Map<String, MemberActivity> activityBuffer = new HashMap<>();
|
||||
private int joinedTick;
|
||||
|
||||
private boolean kickConfirmed = false;
|
||||
|
||||
@Provides
|
||||
ClanChatConfig getConfig(ConfigManager configManager)
|
||||
FriendsChatConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(ClanChatConfig.class);
|
||||
return configManager.getConfig(FriendsChatConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,9 +153,9 @@ public class ClanChatPlugin extends Plugin
|
||||
public void shutDown()
|
||||
{
|
||||
clientThread.invoke(() -> colorIgnoredPlayers(Color.WHITE));
|
||||
clanMembers.clear();
|
||||
removeClanCounter();
|
||||
resetClanChats();
|
||||
members.clear();
|
||||
resetCounter();
|
||||
resetChats();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -165,16 +165,16 @@ public class ClanChatPlugin extends Plugin
|
||||
{
|
||||
if (!config.recentChats())
|
||||
{
|
||||
resetClanChats();
|
||||
resetChats();
|
||||
}
|
||||
|
||||
if (config.showClanCounter())
|
||||
if (config.showCounter())
|
||||
{
|
||||
clientThread.invoke(this::addClanCounter);
|
||||
clientThread.invoke(this::addCounter);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeClanCounter();
|
||||
resetCounter();
|
||||
}
|
||||
|
||||
Color ignoreColor = config.showIgnores() ? config.showIgnoresColor() : Color.WHITE;
|
||||
@@ -183,9 +183,9 @@ public class ClanChatPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onClanMemberJoined(ClanMemberJoined event)
|
||||
public void onFriendsChatMemberJoined(FriendsChatMemberJoined event)
|
||||
{
|
||||
final ClanMember member = event.getMember();
|
||||
final FriendsChatMember member = event.getMember();
|
||||
|
||||
if (member.getWorld() == client.getWorld())
|
||||
{
|
||||
@@ -196,15 +196,15 @@ public class ClanChatPlugin extends Plugin
|
||||
{
|
||||
if (player != null && player != local && memberName.equals(Text.toJagexName(player.getName())))
|
||||
{
|
||||
clanMembers.add(player);
|
||||
addClanCounter();
|
||||
members.add(player);
|
||||
addCounter();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// clan members getting initialized isn't relevant
|
||||
if (clanJoinedTick == client.getTickCount())
|
||||
// members getting initialized isn't relevant
|
||||
if (joinedTick == client.getTickCount())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -218,7 +218,7 @@ public class ClanChatPlugin extends Plugin
|
||||
// attempt to filter out world hopping joins
|
||||
if (!activityBuffer.containsKey(member.getName()))
|
||||
{
|
||||
ClanMemberActivity joinActivity = new ClanMemberActivity(ClanActivityType.JOINED,
|
||||
MemberActivity joinActivity = new MemberActivity(ActivityType.JOINED,
|
||||
member, client.getTickCount());
|
||||
activityBuffer.put(member.getName(), joinActivity);
|
||||
}
|
||||
@@ -229,14 +229,14 @@ public class ClanChatPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onClanMemberLeft(ClanMemberLeft event)
|
||||
public void onFriendsChatMemberLeft(FriendsChatMemberLeft event)
|
||||
{
|
||||
final ClanMember member = event.getMember();
|
||||
final FriendsChatMember member = event.getMember();
|
||||
|
||||
if (member.getWorld() == client.getWorld())
|
||||
{
|
||||
final String memberName = Text.toJagexName(member.getName());
|
||||
final Iterator<Player> each = clanMembers.iterator();
|
||||
final Iterator<Player> each = members.iterator();
|
||||
|
||||
while (each.hasNext())
|
||||
{
|
||||
@@ -244,9 +244,9 @@ public class ClanChatPlugin extends Plugin
|
||||
{
|
||||
each.remove();
|
||||
|
||||
if (clanMembers.isEmpty())
|
||||
if (members.isEmpty())
|
||||
{
|
||||
removeClanCounter();
|
||||
resetCounter();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -262,7 +262,7 @@ public class ClanChatPlugin extends Plugin
|
||||
|
||||
if (!activityBuffer.containsKey(member.getName()))
|
||||
{
|
||||
ClanMemberActivity leaveActivity = new ClanMemberActivity(ClanActivityType.LEFT,
|
||||
MemberActivity leaveActivity = new MemberActivity(ActivityType.LEFT,
|
||||
member, client.getTickCount());
|
||||
activityBuffer.put(member.getName(), leaveActivity);
|
||||
}
|
||||
@@ -280,21 +280,21 @@ public class ClanChatPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
Widget clanChatTitleWidget = client.getWidget(WidgetInfo.CLAN_CHAT_TITLE);
|
||||
if (clanChatTitleWidget != null)
|
||||
Widget chatTitleWidget = client.getWidget(WidgetInfo.FRIENDS_CHAT_TITLE);
|
||||
if (chatTitleWidget != null)
|
||||
{
|
||||
Widget clanChatList = client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
|
||||
Widget owner = client.getWidget(WidgetInfo.CLAN_CHAT_OWNER);
|
||||
ClanMemberManager clanMemberManager = client.getClanMemberManager();
|
||||
if (clanMemberManager != null && clanMemberManager.getCount() > 0)
|
||||
Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST);
|
||||
Widget owner = client.getWidget(WidgetInfo.FRIENDS_CHAT_OWNER);
|
||||
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||
if (friendsChatManager != null && friendsChatManager.getCount() > 0)
|
||||
{
|
||||
clanChatTitleWidget.setText(CLAN_CHAT_TITLE + " (" + clanMemberManager.getCount() + "/100)");
|
||||
chatTitleWidget.setText(TITLE + " (" + friendsChatManager.getCount() + "/100)");
|
||||
}
|
||||
else if (config.recentChats() && clanChatList.getChildren() == null && !Strings.isNullOrEmpty(owner.getText()))
|
||||
else if (config.recentChats() && chatList.getChildren() == null && !Strings.isNullOrEmpty(owner.getText()))
|
||||
{
|
||||
clanChatTitleWidget.setText(RECENT_TITLE);
|
||||
chatTitleWidget.setText(RECENT_TITLE);
|
||||
|
||||
loadClanChats();
|
||||
loadFriendsChats();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,32 +303,32 @@ public class ClanChatPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
timeoutClanMessages();
|
||||
timeoutMessages();
|
||||
|
||||
addClanActivityMessages();
|
||||
addActivityMessages();
|
||||
}
|
||||
|
||||
private void timeoutClanMessages()
|
||||
private void timeoutMessages()
|
||||
{
|
||||
if (clanJoinMessages.isEmpty())
|
||||
if (joinMessages.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
boolean removed = false;
|
||||
|
||||
for (Iterator<ClanJoinMessage> it = clanJoinMessages.iterator(); it.hasNext(); )
|
||||
for (Iterator<MemberJoinMessage> it = joinMessages.iterator(); it.hasNext(); )
|
||||
{
|
||||
ClanJoinMessage clanJoinMessage = it.next();
|
||||
MessageNode messageNode = clanJoinMessage.getMessageNode();
|
||||
final int createdTick = clanJoinMessage.getTick();
|
||||
MemberJoinMessage joinMessage = it.next();
|
||||
MessageNode messageNode = joinMessage.getMessageNode();
|
||||
final int createdTick = joinMessage.getTick();
|
||||
|
||||
if (client.getTickCount() > createdTick + JOIN_LEAVE_DURATION)
|
||||
{
|
||||
it.remove();
|
||||
|
||||
// If this message has been reused since, it will get a different id
|
||||
if (clanJoinMessage.getGetMessageId() == messageNode.getId())
|
||||
if (joinMessage.getGetMessageId() == messageNode.getId())
|
||||
{
|
||||
ChatLineBuffer ccInfoBuffer = client.getChatLineMap().get(ChatMessageType.FRIENDSCHATNOTIFICATION.getType());
|
||||
if (ccInfoBuffer != null)
|
||||
@@ -351,50 +351,50 @@ public class ClanChatPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void addClanActivityMessages()
|
||||
private void addActivityMessages()
|
||||
{
|
||||
ClanMemberManager clanMemberManager = client.getClanMemberManager();
|
||||
if (clanMemberManager == null || activityBuffer.isEmpty())
|
||||
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||
if (friendsChatManager == null || activityBuffer.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<ClanMemberActivity> activityIt = activityBuffer.values().iterator();
|
||||
Iterator<MemberActivity> activityIt = activityBuffer.values().iterator();
|
||||
|
||||
while (activityIt.hasNext())
|
||||
{
|
||||
ClanMemberActivity activity = activityIt.next();
|
||||
MemberActivity activity = activityIt.next();
|
||||
|
||||
if (activity.getTick() < client.getTickCount() - MESSAGE_DELAY)
|
||||
{
|
||||
activityIt.remove();
|
||||
addActivityMessage(clanMemberManager, activity.getMember(), activity.getActivityType());
|
||||
addActivityMessage(friendsChatManager, activity.getMember(), activity.getActivityType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addActivityMessage(ClanMemberManager clanMemberManager, ClanMember member, ClanActivityType activityType)
|
||||
private void addActivityMessage(FriendsChatManager friendsChatManager, FriendsChatMember member, ActivityType activityType)
|
||||
{
|
||||
final String activityMessage = activityType == ClanActivityType.JOINED ? " has joined." : " has left.";
|
||||
final ClanMemberRank rank = member.getRank();
|
||||
Color textColor = CHAT_CLAN_TEXT_OPAQUE_BACKGROUND;
|
||||
Color channelColor = CHAT_CLAN_NAME_OPAQUE_BACKGROUND;
|
||||
final String activityMessage = activityType == ActivityType.JOINED ? " has joined." : " has left.";
|
||||
final FriendsChatRank rank = member.getRank();
|
||||
Color textColor = CHAT_FC_TEXT_OPAQUE_BACKGROUND;
|
||||
Color channelColor = CHAT_FC_NAME_OPAQUE_BACKGROUND;
|
||||
int rankIcon = -1;
|
||||
|
||||
if (client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1)
|
||||
{
|
||||
textColor = CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND;
|
||||
channelColor = CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND;
|
||||
textColor = CHAT_FC_TEXT_TRANSPARENT_BACKGROUND;
|
||||
channelColor = CHAT_FC_NAME_TRANSPARENT_BACKGROUND;
|
||||
}
|
||||
|
||||
if (config.clanChatIcons() && rank != null && rank != ClanMemberRank.UNRANKED)
|
||||
if (config.chatIcons() && rank != null && rank != FriendsChatRank.UNRANKED)
|
||||
{
|
||||
rankIcon = clanManager.getIconNumber(rank);
|
||||
rankIcon = friendChatManager.getIconNumber(rank);
|
||||
}
|
||||
|
||||
ChatMessageBuilder message = new ChatMessageBuilder()
|
||||
.append("[")
|
||||
.append(channelColor, clanMemberManager.getClanChatName());
|
||||
.append(channelColor, friendsChatManager.getName());
|
||||
if (rankIcon > -1)
|
||||
{
|
||||
message
|
||||
@@ -412,16 +412,16 @@ public class ClanChatPlugin extends Plugin
|
||||
final MessageNode[] lines = chatLineBuffer.getLines();
|
||||
final MessageNode line = lines[0];
|
||||
|
||||
ClanJoinMessage clanJoinMessage = new ClanJoinMessage(line, line.getId(), client.getTickCount());
|
||||
clanJoinMessages.addLast(clanJoinMessage);
|
||||
MemberJoinMessage joinMessage = new MemberJoinMessage(line, line.getId(), client.getTickCount());
|
||||
joinMessages.addLast(joinMessage);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onVarClientStrChanged(VarClientStrChanged strChanged)
|
||||
{
|
||||
if (strChanged.getIndex() == VarClientStr.RECENT_CLAN_CHAT.getIndex() && config.recentChats())
|
||||
if (strChanged.getIndex() == VarClientStr.RECENT_FRIENDS_CHAT.getIndex() && config.recentChats())
|
||||
{
|
||||
updateRecentChat(client.getVar(VarClientStr.RECENT_CLAN_CHAT));
|
||||
updateRecentChat(client.getVar(VarClientStr.RECENT_FRIENDS_CHAT));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,8 +433,8 @@ public class ClanChatPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
ClanMemberManager clanMemberManager = client.getClanMemberManager();
|
||||
if (clanMemberManager == null || clanMemberManager.getCount() == 0)
|
||||
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||
if (friendsChatManager == null || friendsChatManager.getCount() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -456,7 +456,7 @@ public class ClanChatPlugin extends Plugin
|
||||
}
|
||||
break;
|
||||
case FRIENDSCHAT:
|
||||
if (!config.clanChatIcons())
|
||||
if (!config.chatIcons())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -465,7 +465,7 @@ public class ClanChatPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
insertClanRankIcon(chatMessage);
|
||||
insertRankIcon(chatMessage);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -475,10 +475,10 @@ public class ClanChatPlugin extends Plugin
|
||||
|
||||
if (gameState == GameState.LOGIN_SCREEN || gameState == GameState.CONNECTION_LOST || gameState == GameState.HOPPING)
|
||||
{
|
||||
clanMembers.clear();
|
||||
removeClanCounter();
|
||||
members.clear();
|
||||
resetCounter();
|
||||
|
||||
clanJoinMessages.clear();
|
||||
joinMessages.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,33 +488,33 @@ public class ClanChatPlugin extends Plugin
|
||||
final Player local = client.getLocalPlayer();
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (player != local && player.isClanMember())
|
||||
if (player != local && player.isFriendsChatMember())
|
||||
{
|
||||
clanMembers.add(player);
|
||||
addClanCounter();
|
||||
members.add(player);
|
||||
addCounter();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPlayerDespawned(PlayerDespawned event)
|
||||
{
|
||||
if (clanMembers.remove(event.getPlayer()) && clanMembers.isEmpty())
|
||||
if (members.remove(event.getPlayer()) && members.isEmpty())
|
||||
{
|
||||
removeClanCounter();
|
||||
resetCounter();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onClanChanged(ClanChanged event)
|
||||
public void onFriendsChatChanged(FriendsChatChanged event)
|
||||
{
|
||||
if (event.isJoined())
|
||||
{
|
||||
clanJoinedTick = client.getTickCount();
|
||||
joinedTick = client.getTickCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
clanMembers.clear();
|
||||
removeClanCounter();
|
||||
members.clear();
|
||||
resetCounter();
|
||||
}
|
||||
|
||||
activityBuffer.clear();
|
||||
@@ -525,16 +525,16 @@ public class ClanChatPlugin extends Plugin
|
||||
{
|
||||
switch (scriptCallbackEvent.getEventName())
|
||||
{
|
||||
case "clanchatInput":
|
||||
case "friendsChatInput":
|
||||
{
|
||||
final int[] intStack = client.getIntStack();
|
||||
final int size = client.getIntStackSize();
|
||||
// If the user accidentally adds a / when the config and the clan chat tab is active, handle it like a normal message
|
||||
boolean alterClanChatDispatch = config.clanTabChat() && !client.getVar(VarClientStr.CHATBOX_TYPED_TEXT).startsWith("/");
|
||||
intStack[size - 1] = alterClanChatDispatch ? 1 : 0;
|
||||
// If the user accidentally adds a / when the config and the friends chat chat tab is active, handle it like a normal message
|
||||
boolean alterDispatch = config.friendsChatTabChat() && !client.getVar(VarClientStr.CHATBOX_TYPED_TEXT).startsWith("/");
|
||||
intStack[size - 1] = alterDispatch ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
case "confirmClanKick":
|
||||
case "confirmFriendsChatKick":
|
||||
{
|
||||
if (!config.confirmKicks() || kickConfirmed)
|
||||
{
|
||||
@@ -561,24 +561,24 @@ public class ClanChatPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onScriptPostFired(ScriptPostFired event)
|
||||
{
|
||||
if (event.getScriptId() == ScriptID.CLAN_CHAT_CHANNEL_BUILD && config.showIgnores())
|
||||
if (event.getScriptId() == ScriptID.FRIENDS_CHAT_CHANNEL_REBUILD && config.showIgnores())
|
||||
{
|
||||
colorIgnoredPlayers(config.showIgnoresColor());
|
||||
}
|
||||
}
|
||||
|
||||
int getClanAmount()
|
||||
int getMembersSize()
|
||||
{
|
||||
return clanMembers.size();
|
||||
return members.size();
|
||||
}
|
||||
|
||||
private void insertClanRankIcon(final ChatMessage message)
|
||||
private void insertRankIcon(final ChatMessage message)
|
||||
{
|
||||
final ClanMemberRank rank = clanManager.getRank(message.getName());
|
||||
final FriendsChatRank rank = friendChatManager.getRank(message.getName());
|
||||
|
||||
if (rank != null && rank != ClanMemberRank.UNRANKED)
|
||||
if (rank != null && rank != FriendsChatRank.UNRANKED)
|
||||
{
|
||||
int iconNumber = clanManager.getIconNumber(rank);
|
||||
int iconNumber = friendChatManager.getIconNumber(rank);
|
||||
final String img = "<img=" + iconNumber + ">";
|
||||
if (message.getType() == ChatMessageType.FRIENDSCHAT)
|
||||
{
|
||||
@@ -594,38 +594,38 @@ public class ClanChatPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void resetClanChats()
|
||||
private void resetChats()
|
||||
{
|
||||
Widget clanChatList = client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
|
||||
Widget clanChatTitleWidget = client.getWidget(WidgetInfo.CLAN_CHAT_TITLE);
|
||||
Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST);
|
||||
Widget chatTitleWidget = client.getWidget(WidgetInfo.FRIENDS_CHAT_TITLE);
|
||||
|
||||
if (clanChatList == null)
|
||||
if (chatList == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ClanMemberManager clanMemberManager = client.getClanMemberManager();
|
||||
if (clanMemberManager == null || clanMemberManager.getCount() == 0)
|
||||
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||
if (friendsChatManager == null || friendsChatManager.getCount() == 0)
|
||||
{
|
||||
clanChatList.setChildren(null);
|
||||
chatList.setChildren(null);
|
||||
}
|
||||
|
||||
clanChatTitleWidget.setText(CLAN_CHAT_TITLE);
|
||||
chatTitleWidget.setText(TITLE);
|
||||
}
|
||||
|
||||
private void loadClanChats()
|
||||
private void loadFriendsChats()
|
||||
{
|
||||
Widget clanChatList = client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
|
||||
if (clanChatList == null)
|
||||
Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST);
|
||||
if (chatList == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int y = 2;
|
||||
clanChatList.setChildren(null);
|
||||
chatList.setChildren(null);
|
||||
for (String chat : Lists.reverse(chats))
|
||||
{
|
||||
Widget widget = clanChatList.createChild(-1, WidgetType.TEXT);
|
||||
Widget widget = chatList.createChild(-1, WidgetType.TEXT);
|
||||
widget.setFontId(494);
|
||||
widget.setTextColor(0xffffff);
|
||||
widget.setText(chat);
|
||||
@@ -659,22 +659,22 @@ public class ClanChatPlugin extends Plugin
|
||||
config.chatsData(Text.toCSV(chats));
|
||||
}
|
||||
|
||||
private void removeClanCounter()
|
||||
private void resetCounter()
|
||||
{
|
||||
infoBoxManager.removeInfoBox(clanMemberCounter);
|
||||
clanMemberCounter = null;
|
||||
infoBoxManager.removeInfoBox(membersIndicator);
|
||||
membersIndicator = null;
|
||||
}
|
||||
|
||||
private void addClanCounter()
|
||||
private void addCounter()
|
||||
{
|
||||
if (!config.showClanCounter() || clanMemberCounter != null || clanMembers.isEmpty())
|
||||
if (!config.showCounter() || membersIndicator != null || members.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final BufferedImage image = spriteManager.getSprite(SpriteID.TAB_CLAN_CHAT, 0);
|
||||
clanMemberCounter = new ClanChatIndicator(image, this);
|
||||
infoBoxManager.addInfoBox(clanMemberCounter);
|
||||
final BufferedImage image = spriteManager.getSprite(SpriteID.TAB_FRIENDS_CHAT, 0);
|
||||
membersIndicator = new MembersIndicator(image, this);
|
||||
infoBoxManager.addInfoBox(membersIndicator);
|
||||
}
|
||||
|
||||
private void confirmKickPlayer(final String kickPlayerName)
|
||||
@@ -684,7 +684,7 @@ public class ClanChatPlugin extends Plugin
|
||||
clientThread.invoke(() ->
|
||||
{
|
||||
kickConfirmed = true;
|
||||
client.runScript(ScriptID.CLAN_SEND_KICK, kickPlayerName);
|
||||
client.runScript(ScriptID.FRIENDS_CHAT_SEND_KICK, kickPlayerName);
|
||||
kickConfirmed = false;
|
||||
})
|
||||
)
|
||||
@@ -694,19 +694,19 @@ public class ClanChatPlugin extends Plugin
|
||||
|
||||
private void colorIgnoredPlayers(Color ignoreColor)
|
||||
{
|
||||
Widget clanChatList = client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
|
||||
if (clanChatList == null || clanChatList.getChildren() == null)
|
||||
Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST);
|
||||
if (chatList == null || chatList.getChildren() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NameableContainer<Ignore> ignoreContainer = client.getIgnoreContainer();
|
||||
// Iterate every 3 widgets, since the order of widgets is name, world, icon
|
||||
for (int i = 0; i < clanChatList.getChildren().length; i += 3)
|
||||
for (int i = 0; i < chatList.getChildren().length; i += 3)
|
||||
{
|
||||
Widget listWidget = clanChatList.getChild(i);
|
||||
String clanMemberName = listWidget.getText();
|
||||
if (clanMemberName.isEmpty() || ignoreContainer.findByName(clanMemberName) == null)
|
||||
Widget listWidget = chatList.getChild(i);
|
||||
String memberName = listWidget.getText();
|
||||
if (memberName.isEmpty() || ignoreContainer.findByName(memberName) == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -22,17 +22,17 @@
|
||||
* (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.client.plugins.clanchat;
|
||||
package net.runelite.client.plugins.friendschat;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Value;
|
||||
import net.runelite.api.ClanMember;
|
||||
import net.runelite.api.FriendsChatMember;
|
||||
|
||||
@Value
|
||||
@AllArgsConstructor
|
||||
class ClanMemberActivity
|
||||
class MemberActivity
|
||||
{
|
||||
private ClanActivityType activityType;
|
||||
private ClanMember member;
|
||||
private ActivityType activityType;
|
||||
private FriendsChatMember member;
|
||||
private Integer tick;
|
||||
}
|
||||
@@ -22,13 +22,13 @@
|
||||
* (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.client.plugins.clanchat;
|
||||
package net.runelite.client.plugins.friendschat;
|
||||
|
||||
import lombok.Value;
|
||||
import net.runelite.api.MessageNode;
|
||||
|
||||
@Value
|
||||
class ClanJoinMessage
|
||||
class MemberJoinMessage
|
||||
{
|
||||
private final MessageNode messageNode;
|
||||
private final int getMessageId;
|
||||
@@ -22,32 +22,32 @@
|
||||
* (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.client.plugins.clanchat;
|
||||
package net.runelite.client.plugins.friendschat;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
import net.runelite.client.ui.overlay.infobox.Counter;
|
||||
|
||||
class ClanChatIndicator extends Counter
|
||||
class MembersIndicator extends Counter
|
||||
{
|
||||
private final ClanChatPlugin plugin;
|
||||
private final FriendsChatPlugin plugin;
|
||||
|
||||
ClanChatIndicator(BufferedImage image, ClanChatPlugin plugin)
|
||||
MembersIndicator(BufferedImage image, FriendsChatPlugin plugin)
|
||||
{
|
||||
super(image, plugin, plugin.getClanAmount());
|
||||
super(image, plugin, plugin.getMembersSize());
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount()
|
||||
{
|
||||
return plugin.getClanAmount();
|
||||
return plugin.getMembersSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip()
|
||||
{
|
||||
return plugin.getClanAmount() + " clan member(s) near you";
|
||||
return plugin.getMembersSize() + " friends chat member(s) near you";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,7 +155,7 @@ public class HiscorePlugin extends Plugin
|
||||
int groupId = WidgetInfo.TO_GROUP(event.getActionParam1());
|
||||
String option = event.getOption();
|
||||
|
||||
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.CLAN_CHAT.getGroupId() ||
|
||||
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.FRIENDS_CHAT.getGroupId() ||
|
||||
groupId == WidgetInfo.CHATBOX.getGroupId() && !KICK_OPTION.equals(option) || //prevent from adding for Kick option (interferes with the raiding party one)
|
||||
groupId == WidgetInfo.RAIDING_PARTY.getGroupId() || groupId == WidgetInfo.PRIVATE_CHAT_MESSAGE.getGroupId() ||
|
||||
groupId == WidgetInfo.IGNORE_LIST.getGroupId())
|
||||
|
||||
@@ -40,7 +40,7 @@ import javax.swing.text.Document;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ClanMemberManager;
|
||||
import net.runelite.api.FriendsChatManager;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Friend;
|
||||
import net.runelite.api.Nameable;
|
||||
@@ -222,20 +222,20 @@ class NameAutocompleter implements KeyListener
|
||||
}
|
||||
}
|
||||
|
||||
// Search clan if a friend wasn't found
|
||||
// Search friends chat if a friend wasn't found
|
||||
if (!autocompleteName.isPresent())
|
||||
{
|
||||
final ClanMemberManager clanMemberManager = client.getClanMemberManager();
|
||||
if (clanMemberManager != null)
|
||||
final FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||
if (friendsChatManager != null)
|
||||
{
|
||||
autocompleteName = Arrays.stream(clanMemberManager.getMembers())
|
||||
autocompleteName = Arrays.stream(friendsChatManager.getMembers())
|
||||
.map(Nameable::getName)
|
||||
.filter(n -> pattern.matcher(n).matches())
|
||||
.findFirst();
|
||||
}
|
||||
}
|
||||
|
||||
// Search cached players if a clannie wasn't found.
|
||||
// Search cached players if a friend wasn't found
|
||||
if (!autocompleteName.isPresent())
|
||||
{
|
||||
final Player[] cachedPlayers = client.getCachedPlayers();
|
||||
|
||||
@@ -48,7 +48,7 @@ enum SpriteOverride
|
||||
TAB_MAGIC_SPELLBOOK_ANCIENT_MAGICKS(SpriteID.TAB_MAGIC_SPELLBOOK_ANCIENT_MAGICKS, AROUND_2005),
|
||||
TAB_MAGIC_SPELLBOOK_LUNAR(SpriteID.TAB_MAGIC_SPELLBOOK_LUNAR, AROUND_2005),
|
||||
TAB_MAGIC_SPELLBOOK_ARCEUUS(SpriteID.TAB_MAGIC_SPELLBOOK_ARCEUUS, AROUND_2005),
|
||||
TAB_CLAN_CHAT(SpriteID.TAB_CLAN_CHAT, AROUND_2005, AROUND_2010),
|
||||
TAB_CLAN_CHAT(SpriteID.TAB_FRIENDS_CHAT, AROUND_2005, AROUND_2010),
|
||||
TAB_FRIENDS(SpriteID.TAB_FRIENDS, AROUND_2005, AROUND_2010),
|
||||
TAB_IGNORES(SpriteID.TAB_IGNORES, AROUND_2005, AROUND_2010),
|
||||
TAB_LOGOUT(SpriteID.TAB_LOGOUT, AROUND_2005, AROUND_2010),
|
||||
|
||||
@@ -46,8 +46,8 @@ enum WidgetOffset
|
||||
RESIZABLE_2010_PRAYER_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_PRAYER_ICON, 172, 1, null, null),
|
||||
RESIZABLE_2010_MAGIC_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_MAGIC_TAB, 205, 1, null, null),
|
||||
RESIZABLE_2010_MAGIC_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_MAGIC_ICON, 206, null, null, null),
|
||||
RESIZABLE_2010_CLAN_CHAT_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_CLAN_CHAT_TAB, -4, 1, null, null),
|
||||
RESIZABLE_2010_CLAN_CHAT_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_CLAN_CHAT_ICON, 2, 1, null, null),
|
||||
RESIZABLE_2010_FRENDS_CHAT_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_FRIENDS_CHAT_TAB, -4, 1, null, null),
|
||||
RESIZABLE_2010_FRIENDS_CHAT_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_FRIENDS_CHAT_ICON, 2, 1, null, null),
|
||||
RESIZABLE_2010_FRIENDS_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_FRIENDS_TAB, 35, 1, null, null),
|
||||
RESIZABLE_2010_FRIENDS_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_FRIENDS_ICON, 37, 1, null, null),
|
||||
RESIZABLE_2010_IGNORES_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_IGNORES_TAB, 69, 1, null, null),
|
||||
@@ -87,8 +87,8 @@ enum WidgetOffset
|
||||
FIXED_2010_PRAYER_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 178, 1, null, null),
|
||||
FIXED_2010_MAGIC_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB, 211, 1, null, null),
|
||||
FIXED_2010_MAGIC_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 212, 1, null, null),
|
||||
FIXED_2010_CLAN_CHAT_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_TAB, 0, 1, null, null),
|
||||
FIXED_2010_CLAN_CHAT_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_ICON, 5, null, null, null),
|
||||
FIXED_2010_FRIENDS_CHAT_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_FRIENDS_CHAT_TAB, 0, 1, null, null),
|
||||
FIXED_2010_FRIENDS_CHAT_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_FRIENDS_CHAT_ICON, 5, null, null, null),
|
||||
FIXED_2010_FRIENDS_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB, 38, 1, 33, null),
|
||||
FIXED_2010_FRIENDS_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 40, null, null, null),
|
||||
FIXED_2010_IGNORES_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB, 72, 1, null, null),
|
||||
@@ -131,8 +131,8 @@ enum WidgetOffset
|
||||
FIXED_2005_PRAYER_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 178, null, null, null),
|
||||
FIXED_2005_MAGIC_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB, 209, 1, 30, null),
|
||||
FIXED_2005_MAGIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 206, 2, null, null),
|
||||
FIXED_2005_CLAN_CHAT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_TAB, 15, null, null, null),
|
||||
FIXED_2005_CLAN_CHAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_ICON, 22, 0, null, null),
|
||||
FIXED_2005_FRIENDS_CHAT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_CHAT_TAB, 15, null, null, null),
|
||||
FIXED_2005_FRIENDS_CHAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_CHAT_ICON, 22, 0, null, null),
|
||||
FIXED_2005_FRIENDS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB, 51, null, 30, null),
|
||||
FIXED_2005_FRIENDS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 49, -1, null, null),
|
||||
FIXED_2005_IGNORES_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB, 79, null, 30, null),
|
||||
@@ -163,8 +163,8 @@ enum WidgetOffset
|
||||
FIXED_2006_PRAYER_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 180, 2, null, null),
|
||||
FIXED_2006_MAGIC_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB, 209, 1, 30, null),
|
||||
FIXED_2006_MAGIC_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 207, 4, null, null),
|
||||
FIXED_2006_CLAN_CHAT_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_TAB, 15, null, null, null),
|
||||
FIXED_2006_CLAN_CHAT_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_ICON, 22, -1, null, null),
|
||||
FIXED_2006_FRIENDS_CHAT_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_FRIENDS_CHAT_TAB, 15, null, null, null),
|
||||
FIXED_2006_FRIENDS_CHAT_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_FRIENDS_CHAT_ICON, 22, -1, null, null),
|
||||
FIXED_2006_FRIENDS_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB, 51, null, 30, null),
|
||||
FIXED_2006_FRIENDS_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 49, 1, null, null),
|
||||
FIXED_2006_IGNORES_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB, 79, null, 30, null),
|
||||
|
||||
@@ -34,7 +34,7 @@ enum WidgetOverride
|
||||
{
|
||||
FIXED_CORNER_TOP_LEFT_2005(Skin.AROUND_2005, "1026", WidgetInfo.FIXED_VIEWPORT_COMBAT_TAB),
|
||||
FIXED_CORNER_TOP_RIGHT_2005(Skin.AROUND_2005, "1027", WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB),
|
||||
FIXED_CORNER_BOTTOM_LEFT_2005(Skin.AROUND_2005, "1028", WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_TAB),
|
||||
FIXED_CORNER_BOTTOM_LEFT_2005(Skin.AROUND_2005, "1028", WidgetInfo.FIXED_VIEWPORT_FRIENDS_CHAT_TAB),
|
||||
FIXED_CORNER_BOTTOM_RIGHT_2005(Skin.AROUND_2005, "1029", WidgetInfo.FIXED_VIEWPORT_MUSIC_TAB),
|
||||
FIXED_TOP_LEFT_2005(Skin.AROUND_2005, "1030_top_left", WidgetInfo.FIXED_VIEWPORT_STATS_TAB, WidgetInfo.FIXED_VIEWPORT_QUESTS_TAB),
|
||||
FIXED_TOP_RIGHT_2005(Skin.AROUND_2005, "1030_top_right", WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_TAB, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB),
|
||||
|
||||
@@ -30,8 +30,8 @@ import java.util.Arrays;
|
||||
import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatPlayer;
|
||||
import net.runelite.api.ClanMember;
|
||||
import net.runelite.api.ClanMemberManager;
|
||||
import net.runelite.api.FriendsChatMember;
|
||||
import net.runelite.api.FriendsChatManager;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Friend;
|
||||
import net.runelite.api.GameState;
|
||||
@@ -145,7 +145,7 @@ public class LeagueChatIconsPlugin extends Plugin
|
||||
{
|
||||
case PRIVATECHAT:
|
||||
case MODPRIVATECHAT:
|
||||
// Note this is unable to change icon on PMs if they are not a friend or in clan chat
|
||||
// Note this is unable to change icon on PMs if they are not a friend or in friends chat
|
||||
case FRIENDSCHAT:
|
||||
String name = Text.removeTags(chatMessage.getName());
|
||||
if (isChatPlayerOnLeague(name))
|
||||
@@ -265,7 +265,7 @@ public class LeagueChatIconsPlugin extends Plugin
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a player name is a friend or clan member on a league world.
|
||||
* Checks if a player name is a friend or friends chat member on a league world.
|
||||
*
|
||||
* @param name name of player to check.
|
||||
* @return boolean true/false.
|
||||
@@ -325,22 +325,22 @@ public class LeagueChatIconsPlugin extends Plugin
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a ChatPlayer object from a clean name by searching clan and friends list.
|
||||
* Gets a ChatPlayer object from a clean name by searching friends chat and friends list.
|
||||
*
|
||||
* @param name name of player to find.
|
||||
* @return ChatPlayer if found, else null.
|
||||
*/
|
||||
private ChatPlayer getChatPlayerFromName(String name)
|
||||
{
|
||||
// Search clan members first, because if a friend is in the clan chat but their private
|
||||
// chat is 'off', then we won't know the world
|
||||
ClanMemberManager clanMemberManager = client.getClanMemberManager();
|
||||
if (clanMemberManager != null)
|
||||
// Search friends chat members first, because we will be able to get the world if their private
|
||||
// is off.
|
||||
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||
if (friendsChatManager != null)
|
||||
{
|
||||
ClanMember clanMember = clanMemberManager.findByName(name);
|
||||
if (clanMember != null)
|
||||
FriendsChatMember member = friendsChatManager.findByName(name);
|
||||
if (member != null)
|
||||
{
|
||||
return clanMember;
|
||||
return member;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,10 +84,10 @@ public interface MinimapConfig extends Config
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "clan",
|
||||
name = "Clan color",
|
||||
description = "Set the minimap color your clan is drawn in"
|
||||
name = "Friends Chat color",
|
||||
description = "Set the minimap color your friends chat members are drawn in"
|
||||
)
|
||||
default Color clanColor() //mapdot 5
|
||||
default Color friendsChatColor() //mapdot 5
|
||||
{
|
||||
return new Color(170, 0, 190);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public class MinimapPlugin extends Plugin
|
||||
colors[2] = config.playerColor();
|
||||
colors[3] = config.friendColor();
|
||||
colors[4] = config.teamColor();
|
||||
colors[5] = config.clanColor();
|
||||
colors[5] = config.friendsChatColor();
|
||||
return colors;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,11 +91,11 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "drawClanMemberNames",
|
||||
name = "Highlight clan members",
|
||||
description = "Configures whether or clan members should be highlighted",
|
||||
name = "Highlight friends chat members",
|
||||
description = "Configures if friends chat members should be highlighted",
|
||||
section = highlightSection
|
||||
)
|
||||
default boolean drawClanMemberNames()
|
||||
default boolean drawFriendsChatMemberNames()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -103,11 +103,11 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "clanMemberColor",
|
||||
name = "Clan member color",
|
||||
description = "Color of clan members",
|
||||
name = "Friends chat member color",
|
||||
description = "Color of friends chat members",
|
||||
section = highlightSection
|
||||
)
|
||||
default Color getClanMemberColor()
|
||||
default Color getFriendsChatMemberColor()
|
||||
{
|
||||
return new Color(170, 0, 255);
|
||||
}
|
||||
@@ -139,11 +139,11 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "drawNonClanMemberNames",
|
||||
name = "Highlight non-clan members",
|
||||
description = "Configures whether or not non-clan members should be highlighted",
|
||||
name = "Highlight others",
|
||||
description = "Configures whether or not other players should be highlighted",
|
||||
section = highlightSection
|
||||
)
|
||||
default boolean highlightNonClanMembers()
|
||||
default boolean highlightOthers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -151,11 +151,11 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 9,
|
||||
keyName = "nonClanMemberColor",
|
||||
name = "Non-clan member color",
|
||||
description = "Color of non-clan member names",
|
||||
name = "Others color",
|
||||
description = "Color of other players names",
|
||||
section = highlightSection
|
||||
)
|
||||
default Color getNonClanMemberColor()
|
||||
default Color getOthersColor()
|
||||
{
|
||||
return Color.RED;
|
||||
}
|
||||
@@ -207,10 +207,10 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 14,
|
||||
keyName = "clanMenuIcons",
|
||||
name = "Show clan ranks",
|
||||
description = "Add clan rank to right click menu and next to player names"
|
||||
name = "Show friends chat ranks",
|
||||
description = "Add friends chat rank to right click menu and next to player names"
|
||||
)
|
||||
default boolean showClanRanks()
|
||||
default boolean showFriendsChatRanks()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -31,10 +31,10 @@ import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.ClanMemberRank;
|
||||
import net.runelite.api.FriendsChatRank;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.game.ClanManager;
|
||||
import net.runelite.client.game.FriendChatManager;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
@@ -49,15 +49,15 @@ public class PlayerIndicatorsOverlay extends Overlay
|
||||
|
||||
private final PlayerIndicatorsService playerIndicatorsService;
|
||||
private final PlayerIndicatorsConfig config;
|
||||
private final ClanManager clanManager;
|
||||
private final FriendChatManager friendChatManager;
|
||||
|
||||
@Inject
|
||||
private PlayerIndicatorsOverlay(PlayerIndicatorsConfig config, PlayerIndicatorsService playerIndicatorsService,
|
||||
ClanManager clanManager)
|
||||
FriendChatManager friendChatManager)
|
||||
{
|
||||
this.config = config;
|
||||
this.playerIndicatorsService = playerIndicatorsService;
|
||||
this.clanManager = clanManager;
|
||||
this.friendChatManager = friendChatManager;
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPriority(OverlayPriority.MED);
|
||||
}
|
||||
@@ -108,37 +108,37 @@ public class PlayerIndicatorsOverlay extends Overlay
|
||||
return;
|
||||
}
|
||||
|
||||
if (config.showClanRanks() && actor.isClanMember())
|
||||
if (config.showFriendsChatRanks() && actor.isFriendsChatMember())
|
||||
{
|
||||
final ClanMemberRank rank = clanManager.getRank(name);
|
||||
final FriendsChatRank rank = friendChatManager.getRank(name);
|
||||
|
||||
if (rank != ClanMemberRank.UNRANKED)
|
||||
if (rank != FriendsChatRank.UNRANKED)
|
||||
{
|
||||
final BufferedImage clanchatImage = clanManager.getClanImage(rank);
|
||||
final BufferedImage rankImage = friendChatManager.getRankImage(rank);
|
||||
|
||||
if (clanchatImage != null)
|
||||
if (rankImage != null)
|
||||
{
|
||||
final int clanImageWidth = clanchatImage.getWidth();
|
||||
final int clanImageTextMargin;
|
||||
final int clanImageNegativeMargin;
|
||||
final int imageWidth = rankImage.getWidth();
|
||||
final int imageTextMargin;
|
||||
final int imageNegativeMargin;
|
||||
|
||||
if (drawPlayerNamesConfig == PlayerNameLocation.MODEL_RIGHT)
|
||||
{
|
||||
clanImageTextMargin = clanImageWidth;
|
||||
clanImageNegativeMargin = 0;
|
||||
imageTextMargin = imageWidth;
|
||||
imageNegativeMargin = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
clanImageTextMargin = clanImageWidth / 2;
|
||||
clanImageNegativeMargin = clanImageWidth / 2;
|
||||
imageTextMargin = imageWidth / 2;
|
||||
imageNegativeMargin = imageWidth / 2;
|
||||
}
|
||||
|
||||
final int textHeight = graphics.getFontMetrics().getHeight() - graphics.getFontMetrics().getMaxDescent();
|
||||
final Point imageLocation = new Point(textLocation.getX() - clanImageNegativeMargin - 1, textLocation.getY() - textHeight / 2 - clanchatImage.getHeight() / 2);
|
||||
OverlayUtil.renderImageLocation(graphics, imageLocation, clanchatImage);
|
||||
final Point imageLocation = new Point(textLocation.getX() - imageNegativeMargin - 1, textLocation.getY() - textHeight / 2 - rankImage.getHeight() / 2);
|
||||
OverlayUtil.renderImageLocation(graphics, imageLocation, rankImage);
|
||||
|
||||
// move text
|
||||
textLocation = new Point(textLocation.getX() + clanImageTextMargin, textLocation.getY());
|
||||
textLocation = new Point(textLocation.getX() + imageTextMargin, textLocation.getY());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import javax.inject.Inject;
|
||||
import lombok.Value;
|
||||
import net.runelite.api.ClanMemberRank;
|
||||
import static net.runelite.api.ClanMemberRank.UNRANKED;
|
||||
import net.runelite.api.FriendsChatRank;
|
||||
import static net.runelite.api.FriendsChatRank.UNRANKED;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuAction.*;
|
||||
import net.runelite.api.MenuEntry;
|
||||
@@ -37,7 +37,7 @@ import net.runelite.api.Player;
|
||||
import net.runelite.api.events.ClientTick;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.ClanManager;
|
||||
import net.runelite.client.game.FriendChatManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
@@ -69,7 +69,7 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ClanManager clanManager;
|
||||
private FriendChatManager friendChatManager;
|
||||
|
||||
@Provides
|
||||
PlayerIndicatorsConfig provideConfig(ConfigManager configManager)
|
||||
@@ -178,14 +178,14 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
{
|
||||
color = config.getFriendColor();
|
||||
}
|
||||
else if (config.drawClanMemberNames() && player.isClanMember())
|
||||
else if (config.drawFriendsChatMemberNames() && player.isFriendsChatMember())
|
||||
{
|
||||
color = config.getClanMemberColor();
|
||||
color = config.getFriendsChatMemberColor();
|
||||
|
||||
ClanMemberRank rank = clanManager.getRank(player.getName());
|
||||
FriendsChatRank rank = friendChatManager.getRank(player.getName());
|
||||
if (rank != UNRANKED)
|
||||
{
|
||||
image = clanManager.getIconNumber(rank);
|
||||
image = friendChatManager.getIconNumber(rank);
|
||||
}
|
||||
}
|
||||
else if (config.highlightTeamMembers()
|
||||
@@ -193,9 +193,9 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
{
|
||||
color = config.getTeamMemberColor();
|
||||
}
|
||||
else if (config.highlightNonClanMembers() && !player.isClanMember())
|
||||
else if (config.highlightOthers() && !player.isFriendsChatMember())
|
||||
{
|
||||
color = config.getNonClanMemberColor();
|
||||
color = config.getOthersColor();
|
||||
}
|
||||
|
||||
if (image == -1 && color == null)
|
||||
@@ -222,7 +222,7 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
newTarget = ColorUtil.prependColorTag(newTarget, decorations.getColor());
|
||||
}
|
||||
|
||||
if (decorations.getImage() != -1 && config.showClanRanks())
|
||||
if (decorations.getImage() != -1 && config.showFriendsChatRanks())
|
||||
{
|
||||
newTarget = "<img=" + decorations.getImage() + ">" + newTarget;
|
||||
}
|
||||
|
||||
@@ -46,8 +46,8 @@ public class PlayerIndicatorsService
|
||||
|
||||
public void forEachPlayer(final BiConsumer<Player, Color> consumer)
|
||||
{
|
||||
if (!config.highlightOwnPlayer() && !config.drawClanMemberNames()
|
||||
&& !config.highlightFriends() && !config.highlightNonClanMembers())
|
||||
if (!config.highlightOwnPlayer() && !config.drawFriendsChatMemberNames()
|
||||
&& !config.highlightFriends() && !config.highlightOthers())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class PlayerIndicatorsService
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean isClanMember = player.isClanMember();
|
||||
boolean isFriendsChatMember = player.isFriendsChatMember();
|
||||
|
||||
if (player == localPlayer)
|
||||
{
|
||||
@@ -74,17 +74,17 @@ public class PlayerIndicatorsService
|
||||
{
|
||||
consumer.accept(player, config.getFriendColor());
|
||||
}
|
||||
else if (config.drawClanMemberNames() && isClanMember)
|
||||
else if (config.drawFriendsChatMemberNames() && isFriendsChatMember)
|
||||
{
|
||||
consumer.accept(player, config.getClanMemberColor());
|
||||
consumer.accept(player, config.getFriendsChatMemberColor());
|
||||
}
|
||||
else if (config.highlightTeamMembers() && localPlayer.getTeam() > 0 && localPlayer.getTeam() == player.getTeam())
|
||||
{
|
||||
consumer.accept(player, config.getTeamMemberColor());
|
||||
}
|
||||
else if (config.highlightNonClanMembers() && !isClanMember)
|
||||
else if (config.highlightOthers() && !isFriendsChatMember)
|
||||
{
|
||||
consumer.accept(player, config.getNonClanMemberColor());
|
||||
consumer.accept(player, config.getOthersColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,10 +91,10 @@ public interface RaidsConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "ccDisplay",
|
||||
name = "CC and World in scout overlay",
|
||||
description = "Display current Clan Chat and World in scouting overlay"
|
||||
name = "FC and World in scout overlay",
|
||||
description = "Display current Friends Chat and World in scouting overlay"
|
||||
)
|
||||
default boolean ccDisplay()
|
||||
default boolean fcDisplay()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.awt.FontMetrics;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ClanMemberManager;
|
||||
import net.runelite.api.FriendsChatManager;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
@@ -101,10 +101,10 @@ public class RaidsOverlay extends OverlayPanel
|
||||
.color(color)
|
||||
.build());
|
||||
|
||||
if (config.ccDisplay())
|
||||
if (config.fcDisplay())
|
||||
{
|
||||
color = Color.RED;
|
||||
ClanMemberManager clanMemberManager = client.getClanMemberManager();
|
||||
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||
FontMetrics metrics = graphics.getFontMetrics();
|
||||
|
||||
String worldString = "W" + client.getWorld();
|
||||
@@ -120,17 +120,17 @@ public class RaidsOverlay extends OverlayPanel
|
||||
}
|
||||
}
|
||||
|
||||
String clanOwner = "Join a CC";
|
||||
if (clanMemberManager != null)
|
||||
String owner = "Join a FC";
|
||||
if (friendsChatManager != null)
|
||||
{
|
||||
clanOwner = clanMemberManager.getClanOwner();
|
||||
owner = friendsChatManager.getOwner();
|
||||
color = Color.ORANGE;
|
||||
}
|
||||
|
||||
panelComponent.setPreferredSize(new Dimension(Math.max(ComponentConstants.STANDARD_WIDTH, metrics.stringWidth(worldString) + metrics.stringWidth(clanOwner) + 14), 0));
|
||||
panelComponent.setPreferredSize(new Dimension(Math.max(ComponentConstants.STANDARD_WIDTH, metrics.stringWidth(worldString) + metrics.stringWidth(owner) + 14), 0));
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left(worldString)
|
||||
.right(clanOwner)
|
||||
.right(owner)
|
||||
.leftColor(Color.ORANGE)
|
||||
.rightColor(color)
|
||||
.build());
|
||||
|
||||
@@ -201,8 +201,8 @@ public class RaidsPlugin extends Plugin
|
||||
|
||||
/*
|
||||
* if the player is in a raid party or not
|
||||
* This will be set when someone in the clan chat clicks the "make party" button on the raids widget
|
||||
* It will change again when someone from your clan enters the raid to generate it
|
||||
* This will be set when someone in the friends chat clicks the "make party" button on the raids widget
|
||||
* It will change again when someone from your friends chat enters the raid to generate it
|
||||
* It will be reset when the raid starts but not if they leave the raid while it has not started yet
|
||||
*/
|
||||
@Getter
|
||||
|
||||
@@ -172,7 +172,7 @@ public interface ScreenshotConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "friendDeath",
|
||||
name = "Screenshot Friend Deaths",
|
||||
description = "Configures whether or not screenshots are automatically taken when friends or clan members die.",
|
||||
description = "Configures whether or not screenshots are automatically taken when friends or friends chat members die.",
|
||||
position = 11,
|
||||
section = whatSection
|
||||
)
|
||||
@@ -219,12 +219,12 @@ public interface ScreenshotConfig extends Config
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ccKick",
|
||||
name = "Screenshot Kicks from CC",
|
||||
description = "Take a screenshot when you kick a user from a clan chat.",
|
||||
name = "Screenshot Kicks from FC",
|
||||
description = "Take a screenshot when you kick a user from a friends chat.",
|
||||
position = 15,
|
||||
section = whatSection
|
||||
)
|
||||
default boolean screenshotCcKick()
|
||||
default boolean screenshotKick()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ public class ScreenshotPlugin extends Plugin
|
||||
{
|
||||
takeScreenshot("Death", "Deaths");
|
||||
}
|
||||
else if (player != client.getLocalPlayer() && (player.isClanMember() || player.isFriend()) && config.screenshotFriendDeath() && player.getCanvasTilePoly() != null)
|
||||
else if (player != client.getLocalPlayer() && (player.isFriendsChatMember() || player.isFriend()) && config.screenshotFriendDeath() && player.getCanvasTilePoly() != null)
|
||||
{
|
||||
takeScreenshot("Death " + player.getName(), "Deaths");
|
||||
}
|
||||
@@ -282,7 +282,7 @@ public class ScreenshotPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onScriptCallbackEvent(ScriptCallbackEvent e)
|
||||
{
|
||||
if (!"confirmClanKick".equals(e.getEventName()))
|
||||
if (!"confirmFriendsChatKick".equals(e.getEventName()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -356,14 +356,14 @@ public class ScreenshotPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
if (config.screenshotCcKick() && chatMessage.equals("Your request to kick/ban this user was successful."))
|
||||
if (config.screenshotKick() && chatMessage.equals("Your request to kick/ban this user was successful."))
|
||||
{
|
||||
if (kickPlayerName == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
takeScreenshot("Kick " + kickPlayerName, "Clan Chat Kicks");
|
||||
takeScreenshot("Kick " + kickPlayerName, "Friends Chat Kicks");
|
||||
kickPlayerName = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ public interface WorldHopperConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "menuOption",
|
||||
name = "Show Hop-to menu option",
|
||||
description = "Adds Hop-to menu option to the friends list and clan members list",
|
||||
description = "Adds Hop-to menu option to the friends list and friends chat members list",
|
||||
position = 7
|
||||
)
|
||||
default boolean menuOption()
|
||||
|
||||
@@ -48,8 +48,8 @@ import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.ChatPlayer;
|
||||
import net.runelite.api.ClanMember;
|
||||
import net.runelite.api.ClanMemberManager;
|
||||
import net.runelite.api.FriendsChatMember;
|
||||
import net.runelite.api.FriendsChatManager;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Friend;
|
||||
import net.runelite.api.GameState;
|
||||
@@ -356,7 +356,7 @@ public class WorldHopperPlugin extends Plugin
|
||||
int groupId = WidgetInfo.TO_GROUP(event.getActionParam1());
|
||||
String option = event.getOption();
|
||||
|
||||
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.CLAN_CHAT.getGroupId())
|
||||
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.FRIENDS_CHAT.getGroupId())
|
||||
{
|
||||
boolean after;
|
||||
|
||||
@@ -730,15 +730,15 @@ public class WorldHopperPlugin extends Plugin
|
||||
{
|
||||
String cleanName = Text.removeTags(name);
|
||||
|
||||
// Search clan members first, because if a friend is in the clan chat but their private
|
||||
// chat is 'off', then the hop-to option will not get shown in the menu (issue #5679).
|
||||
ClanMemberManager clanMemberManager = client.getClanMemberManager();
|
||||
if (clanMemberManager != null)
|
||||
// Search friends chat members first, because we can always get their world;
|
||||
// friends worlds may be hidden if they have private off. (#5679)
|
||||
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||
if (friendsChatManager != null)
|
||||
{
|
||||
ClanMember clanMember = clanMemberManager.findByName(cleanName);
|
||||
if (clanMember != null)
|
||||
FriendsChatMember member = friendsChatManager.findByName(cleanName);
|
||||
if (member != null)
|
||||
{
|
||||
return clanMember;
|
||||
return member;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ public class JagexColors
|
||||
*/
|
||||
public static final Color CHAT_PUBLIC_TEXT_OPAQUE_BACKGROUND = Color.BLUE;
|
||||
public static final Color CHAT_PRIVATE_MESSAGE_TEXT_OPAQUE_BACKGROUND = Color.CYAN;
|
||||
public static final Color CHAT_CLAN_TEXT_OPAQUE_BACKGROUND = new Color(127, 0, 0);
|
||||
public static final Color CHAT_CLAN_NAME_OPAQUE_BACKGROUND = Color.BLUE;
|
||||
public static final Color CHAT_FC_TEXT_OPAQUE_BACKGROUND = new Color(127, 0, 0);
|
||||
public static final Color CHAT_FC_NAME_OPAQUE_BACKGROUND = Color.BLUE;
|
||||
public static final Color CHAT_GAME_EXAMINE_TEXT_OPAQUE_BACKGROUND = Color.BLACK;
|
||||
public static final Color CHAT_TYPED_TEXT_OPAQUE_BACKGROUND = Color.BLUE;
|
||||
|
||||
@@ -46,8 +46,8 @@ public class JagexColors
|
||||
*/
|
||||
public static final Color CHAT_PUBLIC_TEXT_TRANSPARENT_BACKGROUND = new Color(144, 144, 255);
|
||||
public static final Color CHAT_PRIVATE_MESSAGE_TEXT_TRANSPARENT_BACKGROUND = Color.CYAN;
|
||||
public static final Color CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND = new Color(239, 80, 80);
|
||||
public static final Color CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND = new Color(144, 112, 255);
|
||||
public static final Color CHAT_FC_TEXT_TRANSPARENT_BACKGROUND = new Color(239, 80, 80);
|
||||
public static final Color CHAT_FC_NAME_TRANSPARENT_BACKGROUND = new Color(144, 112, 255);
|
||||
public static final Color CHAT_GAME_EXAMINE_TEXT_TRANSPARENT_BACKGROUND = Color.WHITE;
|
||||
public static final Color CHAT_TYPED_TEXT_TRANSPARENT_BACKGROUND = new Color(144, 144, 255);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user