Add global PlayerCount if target is "ALL"

This allows bukkit servers to get the global bungeecord player count.
This commit is contained in:
Robin Lambertz 2013-05-21 22:14:00 +02:00
parent 9be44d51a6
commit c1dfd0fb7b

View File

@ -264,14 +264,21 @@ public class DownstreamBridge extends PacketHandler
} }
if ( subChannel.equals( "PlayerCount" ) ) if ( subChannel.equals( "PlayerCount" ) )
{ {
ServerInfo server = bungee.getServerInfo( in.readUTF() ); String target = in.readUTF();
out.writeUTF( "PlayerCount" );
if ( target.equals( "ALL" ) )
{
out.writeInt( bungee.getPlayers().size() );
} else
{
ServerInfo server = bungee.getServerInfo( target );
if ( server != null ) if ( server != null )
{ {
out.writeUTF( "PlayerCount" );
out.writeUTF( server.getName() ); out.writeUTF( server.getName() );
out.writeInt( server.getPlayers().size() ); out.writeInt( server.getPlayers().size() );
} }
} }
}
if ( subChannel.equals( "PlayerList" ) ) if ( subChannel.equals( "PlayerList" ) )
{ {
String target = in.readUTF(); String target = in.readUTF();