What is the technique for rejecting a user from joining a room by doing a query on the uservariable set in the user?
I have a uservariable set and want to reject them from entering if another user in that room already has this variable set.
I dont think I should do this on the client side by iterating thru the room user list since that is empty at the time you submit the join request.
thanks.
reject a rooom join request question
Can the room extension use an inner class? I am getting this error. The init of the extension seems ok tho.
22 Jan 2012 08:59:05,768 INFO [main] Extensions - {clue}: ClueGameExtension init
22 Jan 2012 09:00:17,117 WARN [pool-1-thread-1] Extensions - {clue}: Cannot instantiate handler class: java.lang.InstantiationException: org.antinori.multiplayer.ClueGameExtension$JoinRoomEventHandler
22 Jan 2012 08:59:05,768 INFO [main] Extensions - {clue}: ClueGameExtension init
22 Jan 2012 09:00:17,117 WARN [pool-1-thread-1] Extensions - {clue}: Cannot instantiate handler class: java.lang.InstantiationException: org.antinori.multiplayer.ClueGameExtension$JoinRoomEventHandler
Seems to be working better now that i broke out the inner class to its own class.
the only thing i see now is below, but not sure it is causing a problem or not.
22 Jan 2012 09:38:13,402 WARN [pool-1-thread-1] v2.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_ROOM, Params: [ZONE, USER, ROOM] } Listener: com.smartfoxserver.v2.entities.managers.SFSExtensionManager@1350ff8
the only thing i see now is below, but not sure it is causing a problem or not.
22 Jan 2012 09:38:13,402 WARN [pool-1-thread-1] v2.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_ROOM, Params: [ZONE, USER, ROOM] } Listener: com.smartfoxserver.v2.entities.managers.SFSExtensionManager@1350ff8
Hi.
What do you mean by inner class? Can you show the code of your extension?
And yes, the way to filter joinRoom requests is by using an extension and then, from the client, call the extension instead of sending the JoinRoomRequest.
What do you mean by inner class? Can you show the code of your extension?
And yes, the way to filter joinRoom requests is by using an extension and then, from the client, call the extension instead of sending the JoinRoomRequest.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
oh, it is just a class inside the parent class. (myclass$innerclass)
public class myextension {
class myrequesthandler {
xxx
}
}
I am not using that anymore.
The problem i have now is using the extension request on an extension for a room.
I am getting this below:
com.smartfoxserver.v2.exceptions.SFSExtensionException: User cannot invoke Room extension if he's not joined in that Room. ( User Name: aasdsa, Id: 0, Priv: 0, Sess: 127.0.0.1:53697 ) , [ Room: The Lobby, Id: 1, Group: default, isGame: true ]
Should i put the extension on the zone level instead of the room level, and then check the settings on the rooms at that level?
I am trying to forbid entry to joining the room by doing a lookup on a room variable if it is true or not. I saw the previous post which mentioned i need to use the extension request instead of the join room event handler because that one fired after they are already joined in the room.
thanks.
public class myextension {
class myrequesthandler {
xxx
}
}
I am not using that anymore.
The problem i have now is using the extension request on an extension for a room.
I am getting this below:
com.smartfoxserver.v2.exceptions.SFSExtensionException: User cannot invoke Room extension if he's not joined in that Room. ( User Name: aasdsa, Id: 0, Priv: 0, Sess: 127.0.0.1:53697 ) , [ Room: The Lobby, Id: 1, Group: default, isGame: true ]
Should i put the extension on the zone level instead of the room level, and then check the settings on the rooms at that level?
I am trying to forbid entry to joining the room by doing a lookup on a room variable if it is true or not. I saw the previous post which mentioned i need to use the extension request instead of the join room event handler because that one fired after they are already joined in the room.
thanks.
Yes, that room join check must go the Zone-Level extension, so you can check for every room.
And yes, send a custom ExtensionRequest from the client (with command like "joinRoom") and then on the Zone-level extension you check if the user is permitted or not to enter that room. If he is, you join him using also the extension, this way you have more control over the situation and don't give much freedom to the client.
And yes, send a custom ExtensionRequest from the client (with command like "joinRoom") and then on the Zone-level extension you check if the user is permitted or not to enter that room. If he is, you join him using also the extension, this way you have more control over the situation and don't give much freedom to the client.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Return to “SFS2X Java / Android API”
Who is online
Users browsing this forum: No registered users and 43 guests