mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-25 11:35:18 +01:00
parent
1ff3035bc0
commit
ceb1cffb00
@ -18,6 +18,7 @@
|
||||
package com.viaversion.viaversion.protocols.v1_20to1_20_2;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.viaversion.nbt.tag.CompoundTag;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.ProtocolInfo;
|
||||
@ -90,6 +91,22 @@ public final class Protocol1_20To1_20_2 extends AbstractProtocol<ClientboundPack
|
||||
sanitizeCustomPayload(wrapper);
|
||||
});
|
||||
|
||||
registerClientbound(ClientboundPackets1_19_4.SYSTEM_CHAT, wrapper -> {
|
||||
if (wrapper.user().isClientSide() || Via.getPlatform().isProxy()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Workaround for GH-3438, where chat messages are sent before the login has completed, usually during proxy server switches
|
||||
// The server will unnecessarily send an error text message, thinking a packet ran into an error, when it was just cancelled and re-queued
|
||||
final JsonElement component = wrapper.passthrough(Types.COMPONENT);
|
||||
if (component instanceof JsonObject object && object.has("translate")) {
|
||||
final JsonElement translate = object.get("translate");
|
||||
if (translate != null && translate.getAsString().equals("multiplayer.message_not_delivered")) {
|
||||
wrapper.cancel();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
registerClientbound(ClientboundPackets1_19_4.RESOURCE_PACK, wrapper -> {
|
||||
final String url = wrapper.passthrough(Types.STRING);
|
||||
final String hash = wrapper.passthrough(Types.STRING);
|
||||
|
Loading…
Reference in New Issue
Block a user