Clear input buffer instead of reading remaining bytes (#3471)

This commit is contained in:
RK_01 2023-10-08 05:05:25 +02:00 committed by GitHub
parent 868c5ba203
commit 0c3d709456
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -49,9 +49,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.LastResourcePack;
import com.viaversion.viaversion.rewriter.SoundRewriter;
import java.util.UUID;
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 static final MappingData MAPPINGS = new MappingDataBase("1.20", "1.20.2");
@ -75,14 +76,14 @@ public final class Protocol1_20_2To1_20 extends AbstractProtocol<ClientboundPack
final String channel = wrapper.passthrough(Type.STRING);
if (channel.equals("minecraft:brand")) {
wrapper.passthrough(Type.STRING);
wrapper.read(Type.REMAINING_BYTES);
wrapper.clearInputBuffer();
}
});
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);
wrapper.clearInputBuffer();
}
});

View File

@ -268,10 +268,9 @@ public class PlayerPackets {
handler(wrapper -> {
String name = wrapper.get(Type.STRING, 0);
if (name.equalsIgnoreCase("MC|BOpen")) {
wrapper.read(Type.REMAINING_BYTES); // Not used anymore
wrapper.clearInputBuffer();
wrapper.write(Type.VAR_INT, 0);
}
if (name.equalsIgnoreCase("MC|TrList")) {
} else if (name.equalsIgnoreCase("MC|TrList")) {
wrapper.passthrough(Type.INT); // ID
Short size = wrapper.passthrough(Type.UNSIGNED_BYTE);