Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inaccurate online player count for Discord leave message #5440

Merged
merged 2 commits into from
Jul 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void onVanishStatusChange(VanishStatusChangeEvent event) {
}

public void sendJoinQuitMessage(final Player player, final String message, MessageType type) {
int userCount = jda.getPlugin().getEss().getUsers().getUserCount();
int onlineCount = jda.getPlugin().getEss().getOnlinePlayers().size();
final MessageFormat format;
switch (type.getKey()) {
case "join":
Expand All @@ -130,7 +130,7 @@ public void sendJoinQuitMessage(final Player player, final String message, Messa
break;
default: // So that it will always be initialised. Other options shouldn't be possible.
format = jda.getSettings().getQuitFormat(player);
userCount = userCount - 1;
onlineCount = onlineCount - 1;
break;

}
Expand All @@ -139,8 +139,8 @@ public void sendJoinQuitMessage(final Player player, final String message, Messa
MessageUtil.sanitizeDiscordMarkdown(player.getName()),
MessageUtil.sanitizeDiscordMarkdown(player.getDisplayName()),
MessageUtil.sanitizeDiscordMarkdown(message),
jda.getPlugin().getEss().getOnlinePlayers().size(),
userCount),
onlineCount,
jda.getPlugin().getEss().getUsers().getUserCount()),
player);
}

Expand Down