diff --git a/module/cmd-server/src/main/java/net/md_5/bungee/module/cmd/server/CommandServer.java b/module/cmd-server/src/main/java/net/md_5/bungee/module/cmd/server/CommandServer.java index 36da83e29..b3ff750fb 100644 --- a/module/cmd-server/src/main/java/net/md_5/bungee/module/cmd/server/CommandServer.java +++ b/module/cmd-server/src/main/java/net/md_5/bungee/module/cmd/server/CommandServer.java @@ -31,21 +31,20 @@ public class CommandServer extends Command implements TabExecutor @Override public void execute(CommandSender sender, String[] args) { - if ( !( sender instanceof ProxiedPlayer ) ) - { - return; - } - ProxiedPlayer player = (ProxiedPlayer) sender; Map servers = ProxyServer.getInstance().getServers(); if ( args.length == 0 ) { - player.sendMessage( ProxyServer.getInstance().getTranslation( "current_server", player.getServer().getInfo().getName() ) ); + if ( sender instanceof ProxiedPlayer ) + { + sender.sendMessage( ProxyServer.getInstance().getTranslation( "current_server", ( (ProxiedPlayer) sender ).getServer().getInfo().getName() ) ); + } + TextComponent serverList = new TextComponent( ProxyServer.getInstance().getTranslation( "server_list" ) ); serverList.setColor( ChatColor.GOLD ); boolean first = true; for ( ServerInfo server : servers.values() ) { - if ( server.canAccess( player ) ) + if ( server.canAccess( sender ) ) { TextComponent serverTextComponent = new TextComponent( first ? server.getName() : ", " + server.getName() ); int count = server.getPlayers().size(); @@ -58,9 +57,15 @@ public class CommandServer extends Command implements TabExecutor first = false; } } - player.sendMessage( serverList ); + sender.sendMessage( serverList ); } else { + if ( !( sender instanceof ProxiedPlayer ) ) + { + return; + } + ProxiedPlayer player = (ProxiedPlayer) sender; + ServerInfo server = servers.get( args[0] ); if ( server == null ) {