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

This is not a Support area! Discuss about the Server here. Non-Server related discussion goes in Off-Topic Discussion.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
Liarco
Posts: 7
Joined: Thu Oct 28, 2010 2:54 pm

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

Post 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! ^^
Last edited by Liarco on Thu Jun 02, 2011 4:08 pm, edited 2 times in total.
User avatar
VlLight
L2j Veteran
L2j Veteran
Posts: 577
Joined: Fri Dec 14, 2007 11:58 am
Location: Russia

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

Post by VlLight »

gameserver/network/L2GameClient.java - onDisconnection() method
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

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

Post by JIV »

dont touch onDisconnection, put it into cleanup()
Liarco
Posts: 7
Joined: Thu Oct 28, 2010 2:54 pm

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

Post by Liarco »

Thank you very much for the replies! :D

Regards.
Post Reply