Throw warning instead of error when trying to send a plugin message to a player thats not connected to a server

This commit is contained in:
ajgeiss0702
2023-04-30 09:59:16 -07:00
parent e9bfeb22b9
commit f1c9749c59
@@ -50,7 +50,8 @@ public class VelocityMethods implements PlatformMethods {
} }
Optional<ServerConnection> server = velocityPlayer.getCurrentServer(); Optional<ServerConnection> server = velocityPlayer.getCurrentServer();
if(!server.isPresent()) { if(!server.isPresent()) {
throw new IllegalStateException("No server to send data to"); logger.warn("Unable to send message to " + player.getName() + ", as they are not connected to any server!");
return;
} }
server.get().sendPluginMessage(MinecraftChannelIdentifier.from("ajqueue:tospigot"), out.toByteArray()); server.get().sendPluginMessage(MinecraftChannelIdentifier.from("ajqueue:tospigot"), out.toByteArray());
} }