mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-12-24 17:47:41 +01:00
#2280: Console usage of /server
This commit is contained in:
parent
8d49424226
commit
ec4279eeb4
@ -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<String, ServerInfo> 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 )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user