From 52c9ca8197203cfd5b0b2a15f67616b4b48605cb Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Sun, 23 Jul 2023 10:10:46 -0400 Subject: [PATCH] Fix inaccurate online player count for Discord leave message (#5440) fixes #5256 --- .../net/essentialsx/discord/listeners/BukkitListener.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EssentialsDiscord/src/main/java/net/essentialsx/discord/listeners/BukkitListener.java b/EssentialsDiscord/src/main/java/net/essentialsx/discord/listeners/BukkitListener.java index f869959f9..6e471786d 100644 --- a/EssentialsDiscord/src/main/java/net/essentialsx/discord/listeners/BukkitListener.java +++ b/EssentialsDiscord/src/main/java/net/essentialsx/discord/listeners/BukkitListener.java @@ -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); }