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-10-25 22:19:27 +01:00
|
|
|
import org.jetbrains.annotations.NotNull;
|
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-10-25 22:19:27 +01:00
|
|
|
public void write(@NotNull 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)
|
2021-03-03 15:46:17 +01:00
|
|
|
writer.writeSizedString(match.tooltipJson != null ? match.tooltipJson.toString() : match.tooltip);
|
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;
|
2021-03-03 15:46:17 +01:00
|
|
|
public String tooltip;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @deprecated Use {@link #tooltip}
|
|
|
|
*/
|
|
|
|
@Deprecated public String tooltipJson;
|
2020-04-11 17:21:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|