Skip to content

Commit eb4d30a

Browse files
committed
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
1 parent 9ca5236 commit eb4d30a

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/Protocol1_20_5To1_20_3.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,8 @@ protected void registerPackets() {
124124
wrapper.write(Types.BOOLEAN, wrapper.user().get(SecureChatStorage.class).enforcesSecureChat());
125125
});
126126

127-
registerServerbound(ServerboundPackets1_20_3.CHAT_COMMAND, ServerboundPackets1_20_5.CHAT_COMMAND_SIGNED, wrapper -> {
128-
final String command = wrapper.passthrough(Types.STRING); // Command
129-
wrapper.passthrough(Types.LONG); // Timestamp
130-
wrapper.passthrough(Types.LONG); // Salt
131-
final int signatures = wrapper.passthrough(Types.VAR_INT); // Signatures
132-
if (signatures == 0) {
133-
wrapper.cancel();
134-
135-
final PacketWrapper chatCommand = wrapper.create(ServerboundPackets1_20_5.CHAT_COMMAND);
136-
chatCommand.write(Types.STRING, command);
137-
chatCommand.sendToServer(Protocol1_20_5To1_20_3.class);
138-
}
139-
});
127+
// Always write as signed, even if there is 0 signatures attached, else the validation chain gets broken
128+
registerServerbound(ServerboundPackets1_20_3.CHAT_COMMAND, ServerboundPackets1_20_5.CHAT_COMMAND_SIGNED);
140129

141130
registerClientbound(State.LOGIN, ClientboundLoginPackets.COOKIE_REQUEST.getId(), -1, wrapper -> handleCookieRequest(wrapper, ServerboundLoginPackets.COOKIE_RESPONSE));
142131
cancelClientbound(ClientboundConfigurationPackets1_20_5.RESET_CHAT); // Old clients already reset chat when entering the configuration phase

0 commit comments

Comments
 (0)