This is a strange bug, since it happens on my test server but not on my local machine, but here goes... The problem is that my custom login event handler isn't being called. I'm adding it to the extension like this:
Code: Select all
addEventHandler(SFSEventType.USER_JOIN_ZONE, OnUserJoinHandler.class);
And the OnUserJoinHandler class is like this:
Code: Select all
public class OnUserJoinHandler extends BaseServerEventHandler {
@Override
public void handleServerEvent(ISFSEvent event) throws SFSException {
User user = (User) event.getParameter(SFSEventParam.USER);
(...)
}
}
As soon as the user is logged in, though, this is the error I get:
Code: Select all
17:11:17,506 INFO [pool-1-thread-2] api.SFSApi - Login in, { Zone: SuperArena }, ( User Name: pgb, Id: 0, Priv: 0, Sess: 10.8.0.6:51126 )
java.lang.ClassCastException: com.smartfoxserver.v2.core.SFSEvent cannot be cast to com.smartfoxserver.v2.core.SFSSystemEvent
at com.smartfoxserver.v2.entities.managers.SFSExtensionManager.dispatchEvent(SFSExtensionManager.java:792)
at com.smartfoxserver.v2.entities.managers.SFSExtensionManager.dispatchZoneLevelEvent(SFSExtensionManager.java:687)
at com.smartfoxserver.v2.entities.managers.SFSExtensionManager.handleServerEvent(SFSExtensionManager.java:883)
at com.smartfoxserver.v2.core.SFSEventManager$SFSEventRunner.run(SFSEventManager.java:64)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
17:11:17,526 WARN [pool-1-thread-2] core.SFSEventManager$SFSEventRunner - Error in event handler: java.lang.ClassCastException: com.smartfoxserver.v2.core.SFSEvent cannot be cast to com.smartfoxserver.v2.core.SFSSystemEvent, Event: { USER_JOIN_ZONE, Params: [USER, ZONE] } Listener: com.smartfoxserver.v2.entities.managers.SFSExtensionManager@2792c07a
Can anyone point me in the right direction? I'd be very grateful...
Thanks!
Pedro.