mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-11-25 12:45:35 +01:00
Fix chat command handling
This commit is contained in:
parent
fccd5b3f3b
commit
fe708ba0eb
@ -122,7 +122,19 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundP
|
||||
wrapper.write(Type.BOOLEAN, wrapper.user().get(SecureChatStorage.class).enforcesSecureChat());
|
||||
});
|
||||
|
||||
registerServerbound(ServerboundPackets1_20_3.CHAT_COMMAND, ServerboundPackets1_20_5.CHAT_COMMAND_SIGNED);
|
||||
registerServerbound(ServerboundPackets1_20_3.CHAT_COMMAND, ServerboundPackets1_20_5.CHAT_COMMAND_SIGNED, wrapper -> {
|
||||
final String command = wrapper.passthrough(Type.STRING); // Command
|
||||
wrapper.passthrough(Type.LONG); // Timestamp
|
||||
wrapper.passthrough(Type.LONG); // Salt
|
||||
final int signatures = wrapper.passthrough(Type.VAR_INT); // Signatures
|
||||
if (signatures == 0) {
|
||||
wrapper.cancel();
|
||||
|
||||
final PacketWrapper chatCommand = wrapper.create(ServerboundPackets1_20_5.CHAT_COMMAND);
|
||||
chatCommand.write(Type.STRING, command);
|
||||
chatCommand.sendToServer(Protocol1_20_3To1_20_5.class);
|
||||
}
|
||||
});
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user