chatchannels: display online member count
Co-authored-by: Dasgust <dasgust@gmail.com>
This commit is contained in:
@@ -206,6 +206,18 @@ public interface ChatChannelConfig extends Config
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "clanChatShowOnlineMemberCount",
|
||||
name = "Show Online Member Count",
|
||||
description = "Shows the number of online clan members at the end of the clan's name.",
|
||||
position = 1,
|
||||
section = clanChatSection
|
||||
)
|
||||
default boolean clanChatShowOnlineMemberCount()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "guestClanChatShowJoinLeave",
|
||||
name = "Show Join/Leave",
|
||||
@@ -217,4 +229,16 @@ public interface ChatChannelConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "guestClanChatShowOnlineMemberCount",
|
||||
name = "Show Online Member Count",
|
||||
description = "Shows the number of online guest clan members at the end of the clan's name.",
|
||||
position = 1,
|
||||
section = guestClanChatSection
|
||||
)
|
||||
default boolean guestClanChatShowOnlineMemberCount()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,6 +145,8 @@ public class ChatChannelPlugin extends Plugin
|
||||
{
|
||||
clientThread.invoke(() -> colorIgnoredPlayers(config.showIgnoresColor()));
|
||||
}
|
||||
|
||||
rebuildClanTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,6 +155,7 @@ public class ChatChannelPlugin extends Plugin
|
||||
chats = null;
|
||||
clientThread.invoke(() -> colorIgnoredPlayers(Color.WHITE));
|
||||
rebuildFriendsChat();
|
||||
rebuildClanTitle();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -167,6 +170,8 @@ public class ChatChannelPlugin extends Plugin
|
||||
|
||||
Color ignoreColor = config.showIgnores() ? config.showIgnoresColor() : Color.WHITE;
|
||||
clientThread.invoke(() -> colorIgnoredPlayers(ignoreColor));
|
||||
|
||||
rebuildClanTitle();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -606,6 +611,18 @@ public class ChatChannelPlugin extends Plugin
|
||||
chatTitle.setText(chatTitle.getText() + " (" + friendsChatManager.getCount() + "/100)");
|
||||
}
|
||||
}
|
||||
else if (event.getScriptId() == ScriptID.CLAN_SIDEPANEL_DRAW)
|
||||
{
|
||||
if (config.clanChatShowOnlineMemberCount())
|
||||
{
|
||||
updateClanTitle(WidgetInfo.CLAN_HEADER, client.getClanChannel());
|
||||
}
|
||||
|
||||
if (config.guestClanChatShowOnlineMemberCount())
|
||||
{
|
||||
updateClanTitle(WidgetInfo.CLAN_GUEST_HEADER, client.getGuestClanChannel());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void insertRankIcon(final ChatMessage message)
|
||||
@@ -740,4 +757,35 @@ public class ChatChannelPlugin extends Plugin
|
||||
listWidget.setTextColor(ignoreColor.getRGB());
|
||||
}
|
||||
}
|
||||
|
||||
private void rebuildClanTitle()
|
||||
{
|
||||
clientThread.invokeLater(() ->
|
||||
{
|
||||
Widget w = client.getWidget(WidgetInfo.CLAN_LAYER);
|
||||
if (w != null)
|
||||
{
|
||||
client.runScript(w.getOnVarTransmitListener());
|
||||
}
|
||||
});
|
||||
|
||||
clientThread.invokeLater(() ->
|
||||
{
|
||||
Widget w = client.getWidget(WidgetInfo.CLAN_GUEST_LAYER);
|
||||
if (w != null)
|
||||
{
|
||||
client.runScript(w.getOnVarTransmitListener());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateClanTitle(WidgetInfo widget, ClanChannel channel)
|
||||
{
|
||||
Widget header = client.getWidget(widget);
|
||||
if (header != null && channel != null)
|
||||
{
|
||||
Widget title = header.getChild(0);
|
||||
title.setText(title.getText() + " (" + channel.getMembers().size() + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user