Don't cancel system chat messages

This commit is contained in:
Nassim Jahnke 2023-09-16 13:27:44 +10:00
parent 9c90445c9c
commit 18c4f90cb0
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
1 changed files with 9 additions and 1 deletions

View File

@ -17,6 +17,7 @@
*/
package com.viaversion.viaversion.protocols.protocol1_20_2to1_20;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.data.MappingData;
import com.viaversion.viaversion.api.data.MappingDataBase;
@ -167,7 +168,14 @@ public final class Protocol1_20_2To1_20 extends AbstractProtocol<ClientboundPack
}
if (configurationBridge.queuedOrSentJoinGame()) {
// Don't try to send configuration packets after the join game packet has been queued or sent
if (!packetWrapper.user().isClientSide() && !Via.getPlatform().isProxy() && unmappedId == ClientboundPackets1_19_4.SYSTEM_CHAT.getId()) {
// Cancelling this on the Vanilla server will cause it to exceptionally resend a message
// Assume that we have already sent the login packet and just let it through
// TODO Maybe just don't wait for the finish config response?
super.transform(direction, State.PLAY, packetWrapper);
return;
}
configurationBridge.addPacketToQueue(packetWrapper, true);
throw CancelException.generate();
}