mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-12 08:41:00 -05:00
3a51f530c6
Changes: - Removed NetInput/NetOutput and replaced them with ByteBuf - Added PacketSerializer to PacketDefinition - Added packet codecs which implementations can supply with custom readers/writers for buffers
32 lines
770 B
Java
32 lines
770 B
Java
package com.github.steveice10.packetlib.test;
|
|
|
|
import com.github.steveice10.packetlib.codec.PacketCodecHelper;
|
|
import com.github.steveice10.packetlib.packet.Packet;
|
|
|
|
import java.io.IOException;
|
|
|
|
public class PingPacket implements Packet {
|
|
private final String id;
|
|
|
|
public PingPacket(ByteBuf buf, PacketCodecHelper codecHelper) throws IOException {
|
|
this.id = codecHelper.readString(buf);
|
|
}
|
|
|
|
public PingPacket(String id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getPingId() {
|
|
return this.id;
|
|
}
|
|
|
|
@Override
|
|
public void write(ByteBuf buf, PacketCodecHelper codecHelper) throws IOException {
|
|
codecHelper.writeString(buf, this.id);
|
|
}
|
|
|
|
@Override
|
|
public boolean isPriority() {
|
|
return false;
|
|
}
|
|
}
|