mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-12 08:41:00 -05:00
Report when packets are not fully read.
This commit is contained in:
parent
62d5509768
commit
885d03759d
1 changed files with 5 additions and 0 deletions
|
@ -39,6 +39,11 @@ public class TcpPacketCodec extends ByteToMessageCodec<Packet> {
|
||||||
|
|
||||||
Packet packet = this.session.getPacketProtocol().createIncomingPacket(id);
|
Packet packet = this.session.getPacketProtocol().createIncomingPacket(id);
|
||||||
packet.read(in);
|
packet.read(in);
|
||||||
|
|
||||||
|
if(buf.readableBytes() > 0) {
|
||||||
|
throw new IllegalStateException("Packet \"" + packet.getClass().getSimpleName() + "\" not fully read.");
|
||||||
|
}
|
||||||
|
|
||||||
if(packet.isPriority()) {
|
if(packet.isPriority()) {
|
||||||
this.session.callEvent(new PacketReceivedEvent(this.session, packet));
|
this.session.callEvent(new PacketReceivedEvent(this.session, packet));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue