3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-16 04:50:10 +01:00

Always map command to signed command in 1.20.5->1.20.3

Sending any message, any non-message command, and again any message would kick the client with a chat validation error. Let's see if this is better
Dieser Commit ist enthalten in:
Nassim Jahnke 2024-08-15 13:35:37 +02:00
Ursprung 9ca523620d
Commit eb4d30ae73
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F

Datei anzeigen

@ -124,19 +124,8 @@ public final class Protocol1_20_5To1_20_3 extends BackwardsProtocol<ClientboundP
wrapper.write(Types.BOOLEAN, wrapper.user().get(SecureChatStorage.class).enforcesSecureChat());
});
registerServerbound(ServerboundPackets1_20_3.CHAT_COMMAND, ServerboundPackets1_20_5.CHAT_COMMAND_SIGNED, wrapper -> {
final String command = wrapper.passthrough(Types.STRING); // Command
wrapper.passthrough(Types.LONG); // Timestamp
wrapper.passthrough(Types.LONG); // Salt
final int signatures = wrapper.passthrough(Types.VAR_INT); // Signatures
if (signatures == 0) {
wrapper.cancel();
final PacketWrapper chatCommand = wrapper.create(ServerboundPackets1_20_5.CHAT_COMMAND);
chatCommand.write(Types.STRING, command);
chatCommand.sendToServer(Protocol1_20_5To1_20_3.class);
}
});
// Always write as signed, even if there is 0 signatures attached, else the validation chain gets broken
registerServerbound(ServerboundPackets1_20_3.CHAT_COMMAND, ServerboundPackets1_20_5.CHAT_COMMAND_SIGNED);
registerClientbound(State.LOGIN, ClientboundLoginPackets.COOKIE_REQUEST.getId(), -1, wrapper -> handleCookieRequest(wrapper, ServerboundLoginPackets.COOKIE_RESPONSE));
cancelClientbound(ClientboundConfigurationPackets1_20_5.RESET_CHAT); // Old clients already reset chat when entering the configuration phase