Page 1 of 1

[SOLVED] How to catch a general "onLogout" event.

Posted: Tue May 31, 2011 7:05 pm
by Liarco
Hi guys,
I'm trying to catch a general logout event... this means that I want my code to run every time that:
  • A player exits the game
  • A player restarts and goes back to the character selection screen
  • The player client crashes or is killed by the user
In a few words: every time that the player closes the connection with the server.

Is there any way to get this by adding an event listener somewhere or do I have to add something to the core files?

I found two places where to put a call to my custom code and here they are:
  • com.l2jserver.gameserver.network.clientpackets.Logout.runImpl(): I think that this is not the right place because the method seems to be called on intentional logouts and not on client crashes.
  • com.l2jserver.gameserver.model.actor.instance.L2PcInstance.cleanup()t: Here is where the TvTEvent does an "onLogout" callback, but I don't understand if the method is called instantly or on cache purge.
Any help is welcome! ^^

Re: How to catch a general "onLogout" event.

Posted: Tue May 31, 2011 7:40 pm
by VlLight
gameserver/network/L2GameClient.java - onDisconnection() method

Re: How to catch a general "onLogout" event.

Posted: Tue May 31, 2011 8:54 pm
by JIV
dont touch onDisconnection, put it into cleanup()

Re: How to catch a general "onLogout" event.

Posted: Tue May 31, 2011 9:15 pm
by Liarco
Thank you very much for the replies! :D

Regards.