Debug log about received packets

This commit is contained in:
Nanit 2021-10-30 20:20:41 +03:00
parent 1e4b4389d5
commit a439aa9847
2 changed files with 6 additions and 1 deletions

View File

@ -29,8 +29,8 @@ public class PacketDecoder extends MessageToMessageDecoder<ByteBuf> {
Packet packet = mappings.getPacket(packetId); Packet packet = mappings.getPacket(packetId);
if (packet != null) { if (packet != null) {
Logger.debug("Received packet %s", packet.toString());
try { try {
Logger.debug("Received packet %s", packet.toString());
packet.decode(msg, version); packet.decode(msg, version);
} catch (Exception e) { } catch (Exception e) {
Logger.warning("Cannot decode packet 0x%s: %s", Integer.toHexString(packetId), e.getMessage()); Logger.warning("Cannot decode packet 0x%s: %s", Integer.toHexString(packetId), e.getMessage());

View File

@ -40,4 +40,9 @@ public class PacketHandshake implements PacketIn {
this.port = msg.readUnsignedShort(); this.port = msg.readUnsignedShort();
this.nextState = State.getById(msg.readVarInt()); this.nextState = State.getById(msg.readVarInt());
} }
@Override
public String toString() {
return getClass().getSimpleName();
}
} }