#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
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args)
|
public void execute(CommandSender sender, String[] args)
|
||||||
{
|
{
|
||||||
if ( !( sender instanceof ProxiedPlayer ) )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ProxiedPlayer player = (ProxiedPlayer) sender;
|
|
||||||
Map<String, ServerInfo> servers = ProxyServer.getInstance().getServers();
|
Map<String, ServerInfo> servers = ProxyServer.getInstance().getServers();
|
||||||
if ( args.length == 0 )
|
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" ) );
|
TextComponent serverList = new TextComponent( ProxyServer.getInstance().getTranslation( "server_list" ) );
|
||||||
serverList.setColor( ChatColor.GOLD );
|
serverList.setColor( ChatColor.GOLD );
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for ( ServerInfo server : servers.values() )
|
for ( ServerInfo server : servers.values() )
|
||||||
{
|
{
|
||||||
if ( server.canAccess( player ) )
|
if ( server.canAccess( sender ) )
|
||||||
{
|
{
|
||||||
TextComponent serverTextComponent = new TextComponent( first ? server.getName() : ", " + server.getName() );
|
TextComponent serverTextComponent = new TextComponent( first ? server.getName() : ", " + server.getName() );
|
||||||
int count = server.getPlayers().size();
|
int count = server.getPlayers().size();
|
||||||
@ -58,9 +57,15 @@ public class CommandServer extends Command implements TabExecutor
|
|||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.sendMessage( serverList );
|
sender.sendMessage( serverList );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
if ( !( sender instanceof ProxiedPlayer ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ProxiedPlayer player = (ProxiedPlayer) sender;
|
||||||
|
|
||||||
ServerInfo server = servers.get( args[0] );
|
ServerInfo server = servers.get( args[0] );
|
||||||
if ( server == null )
|
if ( server == null )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user