Custom login event handler

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

AndreaB330
Posts: 2
Joined: 15 Mar 2017, 23:03

Custom login event handler

Postby AndreaB330 » 15 Mar 2017, 23:20

I have some troubles with addEventHandler(SFSEventType.USER_LOGIN,...). In init() method I have the next line:

Code: Select all

addEventHandler(SFSEventType.USER_LOGIN, LoginEventHandler.class);

and in LoginEventHandler i have one @Override method

Code: Select all

public void handleClientRequest(User sender, ISFSObject params)

I copied it from tutorial, also I added a trace() at the very beginning of the method, but I don't see any debug information. Maybe I didn't notice something, but I really can't find any solution.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Custom login event handler

Postby Lapo » 16 Mar 2017, 09:33

Hi,
you need to turn on the "Custom login" parameter in your Zone from the AdminTool > Zone Configurator.
This will tell the Zone to call your login handler whenever someone sends a Login request.

If you want you can also do it from code in your init() method, with this line:

Code: Select all

getParentZone().setCustomLogin(true);


Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
AndreaB330
Posts: 2
Joined: 15 Mar 2017, 23:03

Re: Custom login event handler

Postby AndreaB330 » 16 Mar 2017, 23:11

Lapo wrote:Hi,
you need to turn on the "Custom login" parameter in your Zone from the AdminTool > Zone Configurator.
This will tell the Zone to call your login handler whenever someone sends a Login request.

If you want you can also do it from code in your init() method, with this line:

Code: Select all

getParentZone().setCustomLogin(true);


Hope it helps


Thanks! It helps, I haven't noticed this property before.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 60 guests