mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-23 18:55:22 +01:00
#3401: Only synchronize necessary parts of the BungeeServerInfo#sendData method
This commit is contained in:
parent
6263fe283b
commit
6324c7d527
@ -103,26 +103,30 @@ public class BungeeServerInfo implements ServerInfo
|
||||
sendData( channel, data, true );
|
||||
}
|
||||
|
||||
// TODO: Don't like this method
|
||||
@Override
|
||||
public boolean sendData(String channel, byte[] data, boolean queue)
|
||||
{
|
||||
Preconditions.checkNotNull( channel, "channel" );
|
||||
Preconditions.checkNotNull( data, "data" );
|
||||
|
||||
synchronized ( packetQueue )
|
||||
Server server;
|
||||
synchronized ( players )
|
||||
{
|
||||
Server server = ( players.isEmpty() ) ? null : players.iterator().next().getServer();
|
||||
server = ( players.isEmpty() ) ? null : players.iterator().next().getServer();
|
||||
}
|
||||
|
||||
if ( server != null )
|
||||
{
|
||||
server.sendData( channel, data );
|
||||
return true;
|
||||
} else if ( queue )
|
||||
{
|
||||
synchronized ( packetQueue )
|
||||
{
|
||||
packetQueue.add( new PluginMessage( channel, data, false ) );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private long lastPing;
|
||||
|
Loading…
Reference in New Issue
Block a user