package com.github.steveice10.mc.protocol.packet.ingame.server;

import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
import com.github.steveice10.packetlib.io.NetInput;
import com.github.steveice10.packetlib.io.NetOutput;

import java.io.IOException;

public class ServerTabCompletePacket extends MinecraftPacket {
    private String matches[];

    @SuppressWarnings("unused")
    private ServerTabCompletePacket() {
    }

    public ServerTabCompletePacket(String matches[]) {
        this.matches = matches;
    }

    public String[] getMatches() {
        return this.matches;
    }

    @Override
    public void read(NetInput in) throws IOException {
        this.matches = new String[in.readVarInt()];
        for(int index = 0; index < this.matches.length; index++) {
            this.matches[index] = in.readString();
        }
    }

    @Override
    public void write(NetOutput out) throws IOException {
        out.writeVarInt(this.matches.length);
        for(String match : this.matches) {
            out.writeString(match);
        }
    }
}

@@ -58,16 +58,146 @@
 erver;%0A%0A
+import com.github.steveice10.mc.protocol.data.message.Message;%0Aimport com.github.steveice10.mc.protocol.data.message.TextMessage;%0A
 import c
@@ -467,191 +467,859 @@
 ate 
-String matches%5B%5D;%0A%0A    @SuppressWarnings(%22unused%22)%0A    private ServerTabCompletePacket() %7B%0A    %7D%0A%0A    public ServerTabCompletePacket(String matches%5B%5D) %7B%0A        this.matches = matches
+int transactionId;%0A    private int start;%0A    private int length;%0A    private String matches%5B%5D;%0A    private Message tooltips%5B%5D;%0A%0A    @SuppressWarnings(%22unused%22)%0A    private ServerTabCompletePacket() %7B%0A    %7D%0A%0A    public ServerTabCompletePacket(int transactionId, int start, int length, String matches%5B%5D, Message tooltips%5B%5D) %7B%0A        if (tooltips.length != matches.length) %7B%0A            throw new IllegalArgumentException(%22Length of matches and tooltips must be equal.%22);%0A        %7D%0A        this.transactionId = transactionId;%0A        this.start = start;%0A        this.length = length;%0A        this.matches = matches;%0A        this.tooltips = tooltips;%0A    %7D%0A%0A    public int getTransactionId() %7B%0A        return this.transactionId;%0A    %7D%0A%0A    public int getStart() %7B%0A        return this.start;%0A    %7D%0A%0A    public int getLength() %7B%0A        return this.length
 ;%0A  
@@ -1386,32 +1386,106 @@
 matches;%0A    %7D%0A%0A
+    public Message%5B%5D getTooltips() %7B%0A        return this.tooltips;%0A    %7D%0A%0A
     @Override%0A  
@@ -1589,16 +1589,78 @@
 Int()%5D;%0A
+        this.tooltips = new TextMessage%5Bthis.matches.length%5D;%0A
         
@@ -1769,16 +1769,142 @@
 ring();%0A
+            if (in.readBoolean()) %7B%0A                this.tooltips%5Bindex%5D = Message.fromString(in.readString());%0A            %7D%0A
         
@@ -2046,74 +2046,372 @@
 for(
-String match : this.matches) %7B%0A            out.writeString(match);
+int index = 0; index %3C this.matches.length; index++) %7B%0A            out.writeString(this.matches%5Bindex%5D);%0A            Message tooltip = this.tooltips%5Bindex%5D;%0A            if (tooltip != null) %7B%0A                out.writeBoolean(true);%0A                out.writeString(tooltip.toJsonString());%0A            %7D else %7B%0A                out.writeBoolean(false);%0A            %7D
 %0A   

Update ServerTabCompletePacket