#3527: Switching between servers causes a decoding error

This commit is contained in:
md_5
2023-09-26 06:35:48 +10:00
parent f3397b3003
commit 3cb7a12738
4 changed files with 12 additions and 4 deletions

View File

@@ -136,8 +136,15 @@ public class UpstreamBridge extends PacketHandler
{
if ( con.getServer() != null )
{
Protocol serverEncode = con.getServer().getCh().getEncodeProtocol();
// #3527: May still have old packets from client in game state when switching server to configuration state - discard those
if ( packet.protocol != serverEncode )
{
return;
}
EntityMap rewrite = con.getEntityRewrite();
if ( rewrite != null && con.getServer().getCh().getEncodeProtocol() == Protocol.GAME )
if ( rewrite != null && serverEncode == Protocol.GAME )
{
rewrite.rewriteServerbound( packet.buf, con.getClientEntityId(), con.getServerEntityId(), con.getPendingConnection().getVersion() );
}