Skip to content

Commit

Permalink
Fix inaccurate online player count for Discord leave message (#5440)
Browse files Browse the repository at this point in the history
fixes #5256
  • Loading branch information
JRoy authored Jul 23, 2023
1 parent f26e1b2 commit 52c9ca8
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 52c9ca8

Please sign in to comment.