Skip to content

Commit 757711a

Browse files
Use correct max tab complete lengths for < 1.13, = 1.13 and > 1.13 (#1796)
1 parent 95694cb commit 757711a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteRequestPacket.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131

3232
public class TabCompleteRequestPacket implements MinecraftPacket {
3333

34-
private static final int VANILLA_MAX_TAB_COMPLETE_LEN = 2048;
35-
3634
private @Nullable String command;
3735
private int transactionId;
3836
private boolean assumeCommand;
@@ -97,9 +95,11 @@ public String toString() {
9795
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
9896
if (version.noLessThan(MINECRAFT_1_13)) {
9997
this.transactionId = ProtocolUtils.readVarInt(buf);
100-
this.command = ProtocolUtils.readString(buf, VANILLA_MAX_TAB_COMPLETE_LEN);
98+
99+
// 1.13 only supports a max length of 256: https://bugs.mojang.com/browse/MC/issues/MC-132663
100+
this.command = ProtocolUtils.readString(buf, version.equals(MINECRAFT_1_13) ? 256 : 32500);
101101
} else {
102-
this.command = ProtocolUtils.readString(buf, VANILLA_MAX_TAB_COMPLETE_LEN);
102+
this.command = ProtocolUtils.readString(buf, 32767);
103103
if (version.noLessThan(MINECRAFT_1_9)) {
104104
this.assumeCommand = buf.readBoolean();
105105
}

0 commit comments

Comments
 (0)