Interface User

All Known Implementing Classes:
SFSUser

public interface User

In the SmartFoxServer 3 API this interface is implemented by the SFSUser class. Read the class description for additional information.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicates whether this user has the specified User Variable set or not.
    Returns the entry point within the User's AOI where this client "appeared" with the last PROXIMITY_LIST_UPDATE event.
    int
    The id of this user.
    The name of this user.
    int
    Returns the id of this user as a player in a Game Room.
    int
    Returns the playerId value of this user in the passed Room.
    int
    Returns the id which identifies the privilege level of this user.
    Returns a reference to the User Manager which manages this user.
    Retrieves a User Variable from its name.
    Retrieves all the User Variables of this user.
    boolean
    Indicates whether this user logged in as an administrator or not.
    boolean
    Indicates whether this user logged in as a guest or not.
    boolean
    Indicates if this User object represents the current client.
    boolean
    Indicates whether this user joined the passed Room or not.
    boolean
    Indicates whether this user logged in as a moderator or not.
    boolean
    Indicates whether this user is a player (playerId greater than 0) in the last joined Room or not.
    boolean
    Indicates whether this user is a player (playerId greater than 0) in the passed Room or not.
    boolean
    Indicates whether this user is a spectator (playerId lower than 0) in the last joined Room or not.
    boolean
    Indicates whether this user is a spectator (playerId lower than 0) in the passed Room or not.
    boolean
    Indicates whether this user logged in as a standard user or not.
    void
     
    void
    setAOIEntryPoint(Vec3D aoiEntryPoint)
     
    void
    setPlayerId(int id, Room room)
     
    void
    setPrivilegeId(int privilegeId)
     
    void
     
    void
    setVariable(UserVariable userVariable)
     
    void
    setVariables(List<? extends UserVariable> userVariables)
     
  • Method Details

    • getId

      int getId()
      The id of this user. It is unique and it is generated by the server when the user is created.
    • getName

      String getName()
      The name of this user. Two users in the same Zone can't have the same name (case sensitive)
    • getPlayerId

      int getPlayerId()
      Returns the id of this user as a player in a Game Room.

      This property differs from the id property and it's 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.

      See Also:
    • isPlayer

      boolean isPlayer()
      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.

      See Also:
    • isSpectator

      boolean isSpectator()
      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.

      See Also:
    • getPlayerId

      int getPlayerId(Room room)
      Returns the playerId value of this user in the passed Room. See the playerId property description for more informations.
      Parameters:
      room - The Room object representing the Room to retrieve the player id from.
      Returns:
      The playerId of this user in the passed Room.
      See Also:
    • setPlayerId

      void setPlayerId(int id, Room room)
      Internal
    • removePlayerId

      void removePlayerId(Room room)
      Internal
    • getPrivilegeId

      int getPrivilegeId()
      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.

      See Also:
    • setPrivilegeId

      void setPrivilegeId(int privilegeId)
      Internal
    • getUserManager

      IUserManager getUserManager()
      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.

    • setUserManager

      void setUserManager(IUserManager userManager)
      Internal
    • isGuest

      boolean isGuest()
      Indicates whether this user logged in as a guest or not. Guest users have the privilegeId property se to UserPrivileges.GUEST.
      Returns:
      true if this user is a guest.
      See Also:
    • isStandardUser

      boolean isStandardUser()
      Indicates whether this user logged in as a standard user or not. Standard users have the privilegeId property se to UserPrivileges.STANDARD.
      Returns:
      true if this user is a standard user.
      See Also:
    • isModerator

      boolean isModerator()
      Indicates whether this user logged in as a moderator or not. Moderator users have the privilegeId property set to UserPrivileges.MODERATOR.
      Returns:
      true if this user is a moderator.
      See Also:
    • isAdmin

      boolean isAdmin()
      Indicates whether this user logged in as an administrator or not. Administrator users have the privilegeId property set to UserPrivileges.ADMINISTRATOR.
      Returns:
      true if this user is an administrator.
      See Also:
    • isPlayerInRoom

      boolean isPlayerInRoom(Room room)
      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 Rooms at a time only, use the isPlayer property.

      Parameters:
      room - The Room object representing the Room where to check if this user is a player.
      Returns:
      true if this user is a player in the passed Room.
      See Also:
    • isSpectatorInRoom

      boolean isSpectatorInRoom(Room room)
      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 Rooms at a time only, use the isSpectator property.

      Parameters:
      room - The Room object representing the Room where to check if this user is a spectator.
      Returns:
      true if this user is a spectator in the passed Room.
      See Also:
    • isJoinedInRoom

      boolean isJoinedInRoom(Room room)
      Indicates whether this user joined the passed Room or not.
      Parameters:
      room - The Room object representing the Room where to check the user presence.
      Returns:
      true if this user is inside the passed Room.
    • isItMe

      boolean isItMe()
      Indicates if this User object represents the current client.
      See Also:
    • getVariables

      List<UserVariable> getVariables()
      Retrieves all the User Variables of this user.
      Returns:
      The list of UserVariable objects associated with the user.
      See Also:
    • getVariable

      UserVariable getVariable(String varName)
      Retrieves a User Variable from its name.
      Parameters:
      varName - The name of the User Variable to be retrieved.
      Returns:
      The UserVariable object representing the User Variable, or null if no User Variable with the passed name is associated with this user.
      See Also:
    • setVariable

      void setVariable(UserVariable userVariable)
      Internal
    • setVariables

      void setVariables(List<? extends UserVariable> userVariables)
      Internal
    • containsVariable

      boolean containsVariable(String name)
      Indicates whether this user has the specified User Variable set or not.
      Parameters:
      name - The name of the User Variable whose existence must be checked.
      Returns:
      true if a User Variable with the passed name is set for this user.
    • getAOIEntryPoint

      Vec3D getAOIEntryPoint()
      Returns the entry point within the User's AOI where this client "appeared" with the last PROXIMITY_LIST_UPDATE event. This field is populated only if the MMORoom is configured to receive this data.
      See Also:
    • setAOIEntryPoint

      void setAOIEntryPoint(Vec3D aoiEntryPoint)
      Internal