Fix inaccurate online player count for Discord leave message (#5440)

fixes #5256
This commit is contained in:
Josh Roy 2023-07-23 10:10:46 -04:00 committed by GitHub
parent f26e1b2e29
commit 52c9ca8197
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,7 +119,7 @@ public class BukkitListener implements Listener {
}
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":
@ -130,7 +130,7 @@ public class BukkitListener implements Listener {
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;
}
@ -139,8 +139,8 @@ public class BukkitListener implements Listener {
MessageUtil.sanitizeDiscordMarkdown(player.getName()),
MessageUtil.sanitizeDiscordMarkdown(player.getDisplayName()),
MessageUtil.sanitizeDiscordMarkdown(message),
jda.getPlugin().getEss().getOnlinePlayers().size(),
userCount),
onlineCount,
jda.getPlugin().getEss().getUsers().getUserCount()),
player);
}