13
0
geforkt von Mirrors/Velocity

Complete tab-complete support back to Minecraft 1.8.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-08-09 10:14:44 -04:00
Ursprung 9a36bd6cae
Commit 2e1de306fb
2 geänderte Dateien mit 13 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -33,7 +33,10 @@ public enum StateRegistry {
PLAY { PLAY {
{ {
SERVERBOUND.register(TabCompleteRequest.class, TabCompleteRequest::new, SERVERBOUND.register(TabCompleteRequest.class, TabCompleteRequest::new,
map(0x01, MINECRAFT_1_12_2), map(0x14, MINECRAFT_1_8),
map(0x01, MINECRAFT_1_9),
map(0x02, MINECRAFT_1_12),
map(0x01, MINECRAFT_1_12_1),
map(0x05, MINECRAFT_1_13)); map(0x05, MINECRAFT_1_13));
SERVERBOUND.register(Chat.class, Chat::new, SERVERBOUND.register(Chat.class, Chat::new,
map(0x01, MINECRAFT_1_8), map(0x01, MINECRAFT_1_8),
@ -69,6 +72,8 @@ public enum StateRegistry {
map(0x0F, MINECRAFT_1_12), map(0x0F, MINECRAFT_1_12),
map(0x0E, MINECRAFT_1_13)); map(0x0E, MINECRAFT_1_13));
CLIENTBOUND.register(TabCompleteResponse.class, TabCompleteResponse::new, CLIENTBOUND.register(TabCompleteResponse.class, TabCompleteResponse::new,
map(0x3A, MINECRAFT_1_8),
map(0x0E, MINECRAFT_1_9),
map(0x0E, MINECRAFT_1_12), map(0x0E, MINECRAFT_1_12),
map(0x10, MINECRAFT_1_13)); map(0x10, MINECRAFT_1_13));
CLIENTBOUND.register(PluginMessage.class, PluginMessage::new, CLIENTBOUND.register(PluginMessage.class, PluginMessage::new,

Datei anzeigen

@ -6,6 +6,7 @@ import com.velocitypowered.proxy.protocol.ProtocolUtils;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import static com.velocitypowered.proxy.protocol.ProtocolConstants.MINECRAFT_1_13; import static com.velocitypowered.proxy.protocol.ProtocolConstants.MINECRAFT_1_13;
import static com.velocitypowered.proxy.protocol.ProtocolConstants.MINECRAFT_1_9;
public class TabCompleteRequest implements MinecraftPacket { public class TabCompleteRequest implements MinecraftPacket {
private int transactionId; private int transactionId;
@ -72,7 +73,9 @@ public class TabCompleteRequest implements MinecraftPacket {
this.command = ProtocolUtils.readString(buf); this.command = ProtocolUtils.readString(buf);
} else { } else {
this.command = ProtocolUtils.readString(buf); this.command = ProtocolUtils.readString(buf);
if (protocolVersion >= MINECRAFT_1_9) {
this.assumeCommand = buf.readBoolean(); this.assumeCommand = buf.readBoolean();
}
this.hasPosition = buf.readBoolean(); this.hasPosition = buf.readBoolean();
if (hasPosition) { if (hasPosition) {
this.position = buf.readLong(); this.position = buf.readLong();
@ -87,7 +90,9 @@ public class TabCompleteRequest implements MinecraftPacket {
ProtocolUtils.writeString(buf, command); ProtocolUtils.writeString(buf, command);
} else { } else {
ProtocolUtils.writeString(buf, command); ProtocolUtils.writeString(buf, command);
if (protocolVersion >= MINECRAFT_1_9) {
buf.writeBoolean(assumeCommand); buf.writeBoolean(assumeCommand);
}
buf.writeBoolean(hasPosition); buf.writeBoolean(hasPosition);
if (hasPosition) { if (hasPosition) {
buf.writeLong(position); buf.writeLong(position);