2017-03-01 19:09:48 -05:00
|
|
|
package com.github.steveice10.packetlib.test;
|
2013-11-29 17:34:06 -05:00
|
|
|
|
2022-05-29 13:40:39 -04:00
|
|
|
import com.github.steveice10.packetlib.codec.PacketCodecHelper;
|
2017-03-01 19:09:48 -05:00
|
|
|
import com.github.steveice10.packetlib.packet.Packet;
|
2013-11-29 17:34:06 -05:00
|
|
|
|
2014-03-01 19:47:03 -05:00
|
|
|
import java.io.IOException;
|
2013-11-29 17:34:06 -05:00
|
|
|
|
|
|
|
public class PingPacket implements Packet {
|
2021-11-13 13:15:43 -05:00
|
|
|
private final String id;
|
2015-07-20 14:02:42 -04:00
|
|
|
|
2022-05-29 13:40:39 -04:00
|
|
|
public PingPacket(ByteBuf buf, PacketCodecHelper codecHelper) throws IOException {
|
|
|
|
this.id = codecHelper.readString(buf);
|
2015-07-20 14:02:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public PingPacket(String id) {
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getPingId() {
|
|
|
|
return this.id;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2022-05-29 13:40:39 -04:00
|
|
|
public void write(ByteBuf buf, PacketCodecHelper codecHelper) throws IOException {
|
|
|
|
codecHelper.writeString(buf, this.id);
|
2015-07-20 14:02:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isPriority() {
|
|
|
|
return false;
|
|
|
|
}
|
2013-11-29 17:34:06 -05:00
|
|
|
}
|