User is null on onUserVariablesUpdate

Post here all your questions related with SmartFoxServer Java API

Moderators: Lapo, Bax

Post Reply
thinknewdev
Posts: 7
Joined: 19 Sep 2010, 03:00

User is null on onUserVariablesUpdate

Post by thinknewdev »

I am geting an error in my Java code where when I join a room and set initial user variables everything works as expected

I then have a button that runs the following code

Code: Select all

/*******************************************

Tell Users Actions

********************************************/
Map<String, SFSVariable> uVars = new HashMap<String,SFSVariable>();

uVars.put("life", new SFSVariable("200", SFSVariable.TYPE_STRING));
uVars.put("posx", new SFSVariable( "150", SFSVariable.TYPE_NUMBER));
uVars.put("posy", new SFSVariable( "200", SFSVariable.TYPE_NUMBER));
			        			     sfsClient.setUserVariables(uVars);
Then I have my event handler

Code: Select all

if(event.getName().equals(SFSEvent.onUserVariablesUpdate))
{

	User tuser = (User) event.getParams().get("user");

					
         if(battleAction != null)
	{
					
	     if(battleAction.equals("attack"))
	    {
			    
	        stv.st.get(tuser.getName()).AnimateTo(new Point((stv.width/2)-48, 150));
	    }	
	}
}
tuser in this case ends up being null. Any reason for that to happen?

Thanks![/code]
Post Reply