Fix issue #216 and #219 by moving current server check to the connect method.

This commit is contained in:
md_5 2013-03-20 20:25:42 +11:00
parent 27d454524f
commit 6813b82b84
2 changed files with 7 additions and 4 deletions

View File

@ -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)

View File

@ -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" );