3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 16:40:10 +01:00

Drop custom payloads with non-alphanumerical brands

For some reason the client errors only if it contains certain characters, needs further investigation. Mojang changed their string writing implementation, though the actual encoding does not seem to have changed, and this error does not occur anywhere else
Dieser Commit ist enthalten in:
Nassim Jahnke 2023-09-24 10:48:47 +10:00
Ursprung 0e8b5e8e98
Commit 8a0e187621

Datei anzeigen

@ -70,6 +70,17 @@ public final class Protocol1_20_2To1_20 extends AbstractProtocol<ClientboundPack
soundRewriter.register1_19_3Sound(ClientboundPackets1_19_4.SOUND); soundRewriter.register1_19_3Sound(ClientboundPackets1_19_4.SOUND);
soundRewriter.registerEntitySound(ClientboundPackets1_19_4.ENTITY_SOUND); soundRewriter.registerEntitySound(ClientboundPackets1_19_4.ENTITY_SOUND);
registerClientbound(ClientboundPackets1_19_4.PLUGIN_MESSAGE, wrapper -> {
final String channel = wrapper.passthrough(Type.STRING);
if (channel.equals("minecraft:brand")) {
final String brand = wrapper.passthrough(Type.STRING);
// TODO No idea what's going on here
if (!brand.matches("[a-zA-Z0-9]+")) {
wrapper.cancel();
}
}
});
registerClientbound(ClientboundPackets1_19_4.RESOURCE_PACK, wrapper -> { registerClientbound(ClientboundPackets1_19_4.RESOURCE_PACK, wrapper -> {
final String url = wrapper.passthrough(Type.STRING); final String url = wrapper.passthrough(Type.STRING);
final String hash = wrapper.passthrough(Type.STRING); final String hash = wrapper.passthrough(Type.STRING);