L2JMobius

How to debug packets

Mobius · 1 · 1510

Online Mobius

  • Administrator
  • Distinguished King
  • *****
    • Posts: 11579
How to debug packets.
Code: [Select]
Index: java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
===================================================================
--- java/org/l2jmobius/gameserver/network/ExIncomingPackets.java (revision 9736)
+++ java/org/l2jmobius/gameserver/network/ExIncomingPackets.java (working copy)
@@ -750,7 +750,16 @@
  @Override
  public IIncomingPacket<GameClient> newIncomingPacket()
  {
- return _incomingPacketFactory.get();
+ final IIncomingPacket<GameClient> packet = _incomingPacketFactory.get();
+ if (packet != null)
+ {
+ System.out.println("[C EX] " + packet.getClass().getSimpleName());
+ }
+ else
+ {
+ System.out.println("[C EX] " + _packetId);
+ }
+ return packet;
  }
 
  @Override
Index: java/org/l2jmobius/gameserver/network/GameClient.java
===================================================================
--- java/org/l2jmobius/gameserver/network/GameClient.java (revision 9826)
+++ java/org/l2jmobius/gameserver/network/GameClient.java (working copy)
@@ -235,6 +235,8 @@
  return;
  }
 
+ System.out.println("[S] " + packet.getClass().getSimpleName());
+
  // TODO: Set as parameter to packets used?
  if (Config.MULTILANG_ENABLE)
  {
Index: java/org/l2jmobius/gameserver/network/IncomingPackets.java
===================================================================
--- java/org/l2jmobius/gameserver/network/IncomingPackets.java (revision 9736)
+++ java/org/l2jmobius/gameserver/network/IncomingPackets.java (working copy)
@@ -244,7 +244,16 @@
  @Override
  public IIncomingPacket<GameClient> newIncomingPacket()
  {
- return _incomingPacketFactory.get();
+ final IIncomingPacket<GameClient> packet = _incomingPacketFactory.get();
+ if (packet != null)
+ {
+ System.out.println("[C] " + packet.getClass().getSimpleName());
+ }
+ else
+ {
+ System.out.println("[C] " + _packetId);
+ }
+ return packet;
  }
 
  @Override

For additional debugging System.out.println("debug") is your friend.