2020-04-24 03:25:58 +02:00
|
|
|
package net.minestom.server.network.packet.server.play;
|
2020-04-11 17:21:53 +02:00
|
|
|
|
2020-10-24 23:28:43 +02:00
|
|
|
import net.minestom.server.chat.JsonMessage;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.network.packet.server.ServerPacket;
|
|
|
|
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
2020-08-19 20:34:21 +02:00
|
|
|
import net.minestom.server.utils.binary.BinaryWriter;
|
2020-04-11 17:21:53 +02:00
|
|
|
|
|
|
|
public class TabCompletePacket implements ServerPacket {
|
|
|
|
|
|
|
|
public int transactionId;
|
|
|
|
public int start;
|
|
|
|
public int length;
|
|
|
|
public Match[] matches;
|
|
|
|
|
|
|
|
@Override
|
2020-08-19 20:34:21 +02:00
|
|
|
public void write(BinaryWriter writer) {
|
2020-04-11 17:21:53 +02:00
|
|
|
writer.writeVarInt(transactionId);
|
|
|
|
writer.writeVarInt(start);
|
|
|
|
writer.writeVarInt(length);
|
|
|
|
|
|
|
|
writer.writeVarInt(matches.length);
|
|
|
|
for (Match match : matches) {
|
|
|
|
writer.writeSizedString(match.match);
|
|
|
|
writer.writeBoolean(match.hasTooltip);
|
|
|
|
if (match.hasTooltip)
|
2020-08-04 04:21:11 +02:00
|
|
|
writer.writeSizedString(match.tooltip.toString());
|
2020-04-11 17:21:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getId() {
|
|
|
|
return ServerPacketIdentifier.TAB_COMPLETE;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class Match {
|
|
|
|
public String match;
|
|
|
|
public boolean hasTooltip;
|
2020-10-24 23:28:43 +02:00
|
|
|
public JsonMessage tooltip; // Only text
|
2020-04-11 17:21:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|