Fix 1.20.2 -> 1.20.1 brand custom payloads properly (#3440)

This commit is contained in:
RK_01 2023-09-25 00:52:17 +02:00 committed by GitHub
parent f91e6a83f9
commit ed1852ba40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,9 +48,10 @@ import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.storage.Configur
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.storage.ConfigurationState.BridgePhase; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.storage.ConfigurationState.BridgePhase;
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.storage.LastResourcePack; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.storage.LastResourcePack;
import com.viaversion.viaversion.rewriter.SoundRewriter; import com.viaversion.viaversion.rewriter.SoundRewriter;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
public final class Protocol1_20_2To1_20 extends AbstractProtocol<ClientboundPackets1_19_4, ClientboundPackets1_20_2, ServerboundPackets1_19_4, ServerboundPackets1_20_2> { public final class Protocol1_20_2To1_20 extends AbstractProtocol<ClientboundPackets1_19_4, ClientboundPackets1_20_2, ServerboundPackets1_19_4, ServerboundPackets1_20_2> {
public static final MappingData MAPPINGS = new MappingDataBase("1.20", "1.20.2"); public static final MappingData MAPPINGS = new MappingDataBase("1.20", "1.20.2");
@ -73,11 +74,15 @@ public final class Protocol1_20_2To1_20 extends AbstractProtocol<ClientboundPack
registerClientbound(ClientboundPackets1_19_4.PLUGIN_MESSAGE, wrapper -> { registerClientbound(ClientboundPackets1_19_4.PLUGIN_MESSAGE, wrapper -> {
final String channel = wrapper.passthrough(Type.STRING); final String channel = wrapper.passthrough(Type.STRING);
if (channel.equals("minecraft:brand")) { if (channel.equals("minecraft:brand")) {
final String brand = wrapper.passthrough(Type.STRING); wrapper.passthrough(Type.STRING);
// TODO No idea what's going on here wrapper.read(Type.REMAINING_BYTES);
if (!brand.matches("[a-zA-Z0-9]+")) { }
wrapper.cancel(); });
} registerServerbound(ServerboundPackets1_20_2.PLUGIN_MESSAGE, wrapper -> {
final String channel = wrapper.passthrough(Type.STRING);
if (channel.equals("minecraft:brand")) {
wrapper.passthrough(Type.STRING);
wrapper.read(Type.REMAINING_BYTES);
} }
}); });