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
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.