Fix scoreboards / tab lists getting out of sync due to race conditions / overlap.

This commit is contained in:
md_5 2016-02-19 09:07:12 +11:00
parent afc02082e6
commit 0646a3090a
4 changed files with 17 additions and 9 deletions

View File

@ -207,6 +207,7 @@ public class ServerConnector extends PacketHandler
}
} else
{
user.getServer().setObsolete( true );
user.getTabListHandler().onServerChange();
Scoreboard serverScoreboard = user.getServerSentScoreboard();
@ -226,7 +227,6 @@ public class ServerConnector extends PacketHandler
user.unsafe().sendPacket( new Respawn( login.getDimension(), login.getDifficulty(), login.getGameMode(), login.getLevelType() ) );
// Remove from old servers
user.getServer().setObsolete( true );
user.getServer().disconnect( "Quitting" );
}

View File

@ -89,14 +89,17 @@ public class DownstreamBridge extends PacketHandler
bungee.getPluginManager().callEvent( serverDisconnectEvent );
}
@Override
public boolean shouldHandle(PacketWrapper packet) throws Exception
{
return !server.isObsolete();
}
@Override
public void handle(PacketWrapper packet) throws Exception
{
if ( !server.isObsolete() )
{
con.getEntityRewrite().rewriteClientbound( packet.buf, con.getServerEntityId(), con.getClientEntityId() );
con.sendPacket( packet );
}
con.getEntityRewrite().rewriteClientbound( packet.buf, con.getServerEntityId(), con.getClientEntityId() );
con.sendPacket( packet );
}
@Override

View File

@ -66,10 +66,10 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
if ( handler != null )
{
PacketWrapper packet = (PacketWrapper) msg;
boolean sendPacket = true;
boolean sendPacket = handler.shouldHandle( packet );
try
{
if ( packet.packet != null )
if ( sendPacket && packet.packet != null )
{
try
{

View File

@ -8,6 +8,11 @@ public abstract class PacketHandler extends net.md_5.bungee.protocol.AbstractPac
@Override
public abstract String toString();
public boolean shouldHandle(PacketWrapper packet) throws Exception
{
return true;
}
public void exception(Throwable t) throws Exception
{
}