From fd7f16189c2ae018ce0a475b306cb4bf38a10953 Mon Sep 17 00:00:00 2001 From: ajgeiss0702 Date: Sat, 11 Dec 2021 10:47:26 -0700 Subject: [PATCH] fix queueevent message attempting to be send when the player is not connected --- .../src/main/java/us/ajg0702/queue/common/QueueManagerImpl.java | 1 + .../queue/platforms/velocity/players/VelocityPlayer.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/us/ajg0702/queue/common/QueueManagerImpl.java b/common/src/main/java/us/ajg0702/queue/common/QueueManagerImpl.java index f09e78e..f9a7c6a 100644 --- a/common/src/main/java/us/ajg0702/queue/common/QueueManagerImpl.java +++ b/common/src/main/java/us/ajg0702/queue/common/QueueManagerImpl.java @@ -433,6 +433,7 @@ public class QueueManagerImpl implements QueueManager { for (QueuePlayer queuePlayer : s.getQueue()) { AdaptedPlayer player = queuePlayer.getPlayer(); if (player == null || !player.isConnected()) continue; + if(player.getServerName() == null) continue; main.getPlatformMethods().sendPluginMessage(player, "inqueueevent", "true"); } } diff --git a/platforms/velocity/src/main/java/us/ajg0702/queue/platforms/velocity/players/VelocityPlayer.java b/platforms/velocity/src/main/java/us/ajg0702/queue/platforms/velocity/players/VelocityPlayer.java index cd1c478..206e05e 100644 --- a/platforms/velocity/src/main/java/us/ajg0702/queue/platforms/velocity/players/VelocityPlayer.java +++ b/platforms/velocity/src/main/java/us/ajg0702/queue/platforms/velocity/players/VelocityPlayer.java @@ -106,7 +106,7 @@ public class VelocityPlayer implements AdaptedPlayer, Audience { @Override public String getServerName() { Optional serverConnection = handle.getCurrentServer(); - if(!serverConnection.isPresent()) return "none"; + if(!serverConnection.isPresent()) return null; ServerConnection connection = serverConnection.get(); return connection.getServerInfo().getName(); }