@ SuppressWarnings ( "unchecked" ) @ Override public < T > T execute ( ) { User sfsUser = CommandUtil . getSfsUser ( agent , api ) ; if ( sfsUser == null ) return null ; try { AgentClassUnwrapper unwrapper = context . getUserAgentClass ( agent . getClass ( ) ) . getUnwrapper ( ) ; List < UserVariable > variables = new UserAgentSerializer ( ) . serialize ( unwrapper , agent ) ; List < UserVariable > answer = variables ; if ( includedVars . size ( ) > 0 ) answer = getVariables ( variables , includedVars ) ; answer . removeAll ( getVariables ( answer , excludedVars ) ) ; //update user variables on server and notify to client if ( toClient ) api . setUserVariables ( sfsUser , answer ) ; // only update user variables on server else sfsUser . setVariables ( answer ) ; } catch ( SFSVariableException e ) { throw new IllegalStateException ( e ) ; } return ( T ) agent ; }
Execute to update user variables