diff --git a/src/main/java/io/github/kmaba/vLobbyConnect/HubCommand.java b/src/main/java/io/github/kmaba/vLobbyConnect/HubCommand.java index 96145db..53b23f3 100644 --- a/src/main/java/io/github/kmaba/vLobbyConnect/HubCommand.java +++ b/src/main/java/io/github/kmaba/vLobbyConnect/HubCommand.java @@ -80,8 +80,12 @@ public void execute(Invocation invocation) { return; } + if (player.getCurrentServer().isPresent() && player.getCurrentServer().get().getServerInfo().getName().equals(actualLobbyName)) { + player.sendMessage(Component.text("&cYou are already in a lobby.")); + return; + } + logger.info("Player {} connecting to lobby '{}'", player.getUsername(), typedKey); player.createConnectionRequest(targetServer.get()).fireAndForget(); - player.sendMessage(Component.text("Connecting to " + typedKey + "...")); } -} \ No newline at end of file +} diff --git a/src/main/java/io/github/kmaba/vLobbyConnect/LobbyCommand.java b/src/main/java/io/github/kmaba/vLobbyConnect/LobbyCommand.java index 71ea4e5..4c3a214 100644 --- a/src/main/java/io/github/kmaba/vLobbyConnect/LobbyCommand.java +++ b/src/main/java/io/github/kmaba/vLobbyConnect/LobbyCommand.java @@ -80,8 +80,12 @@ public void execute(Invocation invocation) { return; } + if (player.getCurrentServer().isPresent() && player.getCurrentServer().get().getServerInfo().getName().equals(actualLobbyName)) { + player.sendMessage(Component.text("&cYou are already in a lobby.")); + return; + } + logger.info("Player {} connecting to lobby '{}'", player.getUsername(), typedKey); player.createConnectionRequest(targetServer.get()).fireAndForget(); - player.sendMessage(Component.text("Connecting to " + typedKey + "...")); } -} \ No newline at end of file +}