Improve debugging

This commit is contained in:
BoomEaro 2022-06-08 12:08:38 +03:00
parent 32c95cc5cd
commit 788c9ba4f2
3 changed files with 4 additions and 4 deletions

View File

@ -47,7 +47,7 @@ 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()); Logger.debug("Received packet %s[0x%s]", packet.toString(), Integer.toHexString(packetId));
try { try {
packet.decode(msg, version); packet.decode(msg, version);
} catch (Exception e) { } catch (Exception e) {

View File

@ -51,7 +51,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet> {
} }
if (packetId == -1) { if (packetId == -1) {
Logger.warning("Undefined packet class: %s", packet.getClass().getName()); Logger.warning("Undefined packet class: %s[0x%s]", packet.getClass().getName(), Integer.toHexString(packetId));
return; return;
} }
@ -61,7 +61,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet> {
packet.encode(msg, version); packet.encode(msg, version);
if (Logger.getLevel() >= 3) { if (Logger.getLevel() >= 3) {
Logger.debug("Sending %s packet (%d bytes)", packet.toString(), msg.readableBytes()); Logger.debug("Sending %s[0x%s] packet (%d bytes)", packet.toString(), Integer.toHexString(packetId), msg.readableBytes());
} }
} catch (Exception e) { } catch (Exception e) {
Logger.error("Cannot encode packet 0x%s: %s", Integer.toHexString(packetId), e.getMessage()); Logger.error("Cannot encode packet 0x%s: %s", Integer.toHexString(packetId), e.getMessage());

View File

@ -210,7 +210,7 @@ public enum State {
map(0x54, V1_15, V1_15_2), map(0x54, V1_15, V1_15_2),
map(0x53, V1_16, V1_16_4), map(0x53, V1_16, V1_16_4),
map(0x5E, V1_17, V1_17_1), map(0x5E, V1_17, V1_17_1),
map(0x60, V1_18, V1_18_2) map(0x60, V1_18, V1_19)
); );
} }
}; };