Packagecom.smartfoxserver.v2.entities
Interfacepublic interface User
Implementors SFSUser

The User interface defines all the methods and properties that an object representing a SmartFoxServer User entity exposes.

In the SmartFoxServer 2X client API this interface is implemented by the SFSUser class. Read the class description for additional informations.

See also

SFSUser


Public Properties
 PropertyDefined By
  aoiEntryPoint : Vec3D
Returns the entry point of this user in the current user's AoI.
User
  id : int
[read-only] Indicates the id of this user.
User
  isItMe : Boolean
[read-only] Indicates if this User object represents the current client.
User
  isPlayer : Boolean
[read-only] Indicates whether this user is a player (playerId greater than 0) in the last joined Room or not.
User
  isSpectator : Boolean
[read-only] Indicates whether this user is a spectator (playerId lower than 0) in the last joined Room or not.
User
  name : String
[read-only] Indicates the name of this user.
User
  playerId : int
[read-only] Returns the id of this user as a player in a Game Room.
User
  privilegeId : int
Returns the id which identifies the privilege level of this user.
User
  properties : Object
Defines a generic utility object that can be used to store custom user data.
User
  userManager : IUserManager
Returns a reference to the User Manager which manages this user.
User
Public Methods
 MethodDefined By
  
containsVariable(name:String):Boolean
Indicates whether this user has the specified User Variable set or not.
User
  
getPlayerId(room:Room):int
Returns the playerId value of this user in the passed Room.
User
  
Retrieves a User Variable from its name.
User
  
getVariables():Array
Retrieves all the User Variables of this user.
User
  
isAdmin():Boolean
Indicates whether this user logged in as an administrator or not.
User
  
isGuest():Boolean
Indicates whether this user logged in as a guest or not.
User
  
isJoinedInRoom(room:Room):Boolean
Indicates whether this user joined the passed Room or not.
User
  
isModerator():Boolean
Indicates whether this user logged in as a moderator or not.
User
  
isPlayerInRoom(room:Room):Boolean
Indicates whether this user is a player (playerId greater than 0) in the passed Room or not.
User
  
isSpectatorInRoom(room:Room):Boolean
Indicates whether this user is a spectator (playerId lower than 0) in the passed Room or not.
User
  
isStandardUser():Boolean
Indicates whether this user logged in as a standard user or not.
User
Property Detail
aoiEntryPointproperty
aoiEntryPoint:Vec3D

Returns the entry point of this user in the current user's AoI.

The returned coordinates are those that the user had when his presence in the current user's Area of Interest was last notified by a SFSEvent.PROXIMITY_LIST_UPDATE event. This field is populated only if the user joined a Room of type MMORoom and this is configured to receive such data from the server.


Implementation
    public function get aoiEntryPoint():Vec3D
    public function set aoiEntryPoint(value:Vec3D):void

See also

idproperty 
id:int  [read-only]

Indicates the id of this user. It is unique and it is generated by the server when the user is created.


Implementation
    public function get id():int
isItMeproperty 
isItMe:Boolean  [read-only]

Indicates if this User object represents the current client.


Implementation
    public function get isItMe():Boolean

See also

isPlayerproperty 
isPlayer:Boolean  [read-only]

Indicates whether this user is a player (playerId greater than 0) in the last joined Room or not. Non-Game Rooms always return false.

If the user is inside multiple Game Rooms at the same time, use the isPlayerInRoom() method.


Implementation
    public function get isPlayer():Boolean

See also

isSpectatorproperty 
isSpectator:Boolean  [read-only]

Indicates whether this user is a spectator (playerId lower than 0) in the last joined Room or not. Non-Game Rooms always return false.

If the user is inside multiple Game Rooms at the same time, use the isSpectatorInRoom() method.


Implementation
    public function get isSpectator():Boolean

See also

nameproperty 
name:String  [read-only]

Indicates the name of this user. Two users in the same Zone can't have the same name.


Implementation
    public function get name():String
playerIdproperty 
playerId:int  [read-only]

Returns the id of this user as a player in a Game Room.

This property differs from id property and it used to indicate which player number is assigned to a user inside a Game Room. For example, in a Game Room for 5 players the first client joining it will have playerId equal to 1, the second will have it equal to 2 and so forth. When a user leaves the Room the player slot is freed up and the next user joining the Room will take it.

The playerId property applies to Game Rooms only; in standard Rooms it is always 0. Also, in Game Rooms a playerId value lower than 0 indicates that the user is a spectator.

If the user is inside multiple Game Rooms at the same time, a different playerId value will be assigned to him in each Room. In this case this property returns the value corresponding to the last joined Room; in order to obtain the playerId value in a specific Room, use the getPlayerId() method.


Implementation
    public function get playerId():int

See also

privilegeIdproperty 
privilegeId:int

Returns the id which identifies the privilege level of this user.

NOTE: setting the privilegeId property manually has no effect on the server and can disrupt the API functioning. Privileges are assigned to the user by the server when the user logs in.


Implementation
    public function get privilegeId():int
    public function set privilegeId(value:int):void

See also

propertiesproperty 
properties:Object

Defines a generic utility object that can be used to store custom user data. The values added to this object are for client-side use only and are never transmitted to the server or to the other clients.


Implementation
    public function get properties():Object
    public function set properties(value:Object):void
userManagerproperty 
userManager:IUserManager

Returns a reference to the User Manager which manages this user.

NOTE: setting the userManager property manually has no effect on the server and can disrupt the API functioning.


Implementation
    public function get userManager():IUserManager
    public function set userManager(value:IUserManager):void
Method Detail
containsVariable()method
public function containsVariable(name:String):Boolean

Indicates whether this user has the specified User Variable set or not.

Parameters

name:String — The name of the User Variable whose existance must be checked.

Returns
Booleantrue if a User Variable with the passed name is set for this user.
getPlayerId()method 
public function getPlayerId(room:Room):int

Returns the playerId value of this user in the passed Room. See the playerId property description for more informations.

Parameters

room:Room — The Room object representing the Room to retrieve the player id from.

Returns
int — The playerId of this user in the passed Room.

See also

getVariable()method 
public function getVariable(name:String):UserVariable

Retrieves a User Variable from its name.

Parameters

name:String — The name of the User Variable to be retrieved.

Returns
UserVariable — The UserVariable object representing the User Variable, or null if no User Variable with the passed name is associated with this user.

See also

getVariables()method 
public function getVariables():Array

Retrieves all the User Variables of this user.

Returns
Array — The list of UserVariable objects associated with the user.

See also

isAdmin()method 
public function isAdmin():Boolean

Indicates whether this user logged in as an administrator or not. Administrator users have the privilegeId property set to UserPrivileges.ADMINISTRATOR.

Returns
Booleantrue if this user is an administrator.

See also

isGuest()method 
public function isGuest():Boolean

Indicates whether this user logged in as a guest or not. Guest users have the privilegeId property set to UserPrivileges.GUEST.

Returns
Booleantrue if this user is a guest.

See also

isJoinedInRoom()method 
public function isJoinedInRoom(room:Room):Boolean

Indicates whether this user joined the passed Room or not.

Parameters

room:Room — The Room object representing the Room where to check the user presence.

Returns
Booleantrue if this user is inside the passed Room.
isModerator()method 
public function isModerator():Boolean

Indicates whether this user logged in as a moderator or not. Moderator users have the privilegeId property set to UserPrivileges.MODERATOR.

Returns
Booleantrue if this user is a moderator.

See also

isPlayerInRoom()method 
public function isPlayerInRoom(room:Room):Boolean

Indicates whether this user is a player (playerId greater than 0) in the passed Room or not. Non-Game Rooms always return false.

If a user can join one Game Room at a time only, use the isPlayer property.

Parameters

room:Room — The Room object representing the Room where to check if this user is a player.

Returns
Booleantrue if this user is a player in the passed Room.

See also

isSpectatorInRoom()method 
public function isSpectatorInRoom(room:Room):Boolean

Indicates whether this user is a spectator (playerId lower than 0) in the passed Room or not. Non-Game Rooms always return false.

If a user can join one Game Room at a time only, use the isSpectator property.

Parameters

room:Room — The Room object representing the Room where to check if this user is a spectator.

Returns
Booleantrue if this user is a spectator in the passed Room.

See also

isStandardUser()method 
public function isStandardUser():Boolean

Indicates whether this user logged in as a standard user or not. Standard users have the privilegeId property set to UserPrivileges.STANDARD.

Returns
Booleantrue if this user is a standard user.

See also