From 6813b82b840e851180d932de34a8f6fad57ee39f Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 20 Mar 2013 20:25:42 +1100 Subject: [PATCH] Fix issue #216 and #219 by moving current server check to the connect method. --- proxy/src/main/java/net/md_5/bungee/UserConnection.java | 8 +++++++- .../main/java/net/md_5/bungee/command/CommandServer.java | 3 --- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index a4aa91c7..0d0ba238 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -98,7 +98,13 @@ public final class UserConnection implements ProxiedPlayer @Override public void connect(ServerInfo target) { - connect( target, false ); + if ( getServer() != null && getServer().getInfo() == target ) + { + sendMessage( ChatColor.RED + "Cannot connect to server you are already on!" ); + } else + { + connect( target, false ); + } } public void connectNow(ServerInfo target) diff --git a/proxy/src/main/java/net/md_5/bungee/command/CommandServer.java b/proxy/src/main/java/net/md_5/bungee/command/CommandServer.java index f09d86a5..aa871be3 100644 --- a/proxy/src/main/java/net/md_5/bungee/command/CommandServer.java +++ b/proxy/src/main/java/net/md_5/bungee/command/CommandServer.java @@ -50,9 +50,6 @@ public class CommandServer extends Command if ( server == null ) { player.sendMessage( ChatColor.RED + "The specified server does not exist" ); - } else if ( server.equals( player.getServer().getInfo() ) ) - { - player.sendMessage( ChatColor.RED + "You are already on this server." ); } else if ( !server.canAccess( player ) ) { player.sendMessage( ChatColor.RED + "You don't have permission to access this server" );