Interface Room

All Known Implementing Classes:
MMORoom, SFSRoom

public interface Room

In the SmartFoxServer 3 client API this interface is implemented by the SFSRoom class. Read the class description for additional informations.

See Also:
  • Method Details

    • getId

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

      String getName()
      The unique name of this Room. Two Rooms in the same Zone can't have the same name (in a case sensitive way)

      NOTE: setting the name property manually has no effect on the server and can disrupt the API functioning. Use the ChangeRoomNameRequest request instead.

      See Also:
    • setName

      void setName(String name)
      Internal
    • getGroupId

      String getGroupId()
      Returns the Room Group name. Each Group is identified by a unique string (its name or id) and it represents a different "container" for Rooms.

      Room Groups enable developers to organize Rooms under different types or categories and let clients select only those Groups they are interested in, in order to receive their events only. This is done via the SubscribeRoomGroupRequest and UnsubscribeRoomGroupRequest requests.

      The default value is default.

      See Also:
    • isJoined

      boolean isJoined()
      Indicates whether the client joined this Room or not.

      NOTE: setting the isJoined property manually has no effect on the server and can disrupt the API functioning. Use the JoinRoomRequest request to join a new Room instead.

      See Also:
    • isGame

      boolean isGame()
      Indicates whether this is a Game Room or not.

      NOTE: setting the isGame property manually has no effect on the server and can disrupt the API functioning. This flag must be set when creating the Room.

    • isHidden

      boolean isHidden()
      Indicates whether this Room is hidden or not. This is a utility flag that can be used by developers to hide certain Rooms from the interface of their application.

      NOTE: setting the isHidden property manually has no effect on the server and can disrupt the API functioning. This flag must be set when creating the Room.

    • isPasswordProtected

      boolean isPasswordProtected()
      Indicates whether this Room requires a password to be joined or not.

      NOTE: setting the isPasswordProtected property manually has no effect on the server and can disrupt the API functioning. This flag depends on the Room's password set when the Room is created or by means of the ChangeRoomPasswordStateRequest request.

      See Also:
    • setPasswordProtected

      void setPasswordProtected(boolean passwordProtected)
      Internal
    • isManaged

      boolean isManaged()
      Internal
    • getUserCount

      int getUserCount()
      Returns the current number of users in this Room. In case of Game Rooms, this is the number of players.

      NOTE: setting the userCount property manually has no effect on the server and can disrupt the API functioning. This flag depends on the Room state.

    • getMaxUsers

      int getMaxUsers()
      Returns the maximum number of users allowed in this Room. In case of Game Rooms, this is the maximum number of players.

      NOTE: setting the maxUsers property manually has no effect on the server and can disrupt the API functioning. This flag must be set when creating the Room.

    • getSpectatorCount

      int getSpectatorCount()
      Returns the current number of spectators in this Room (Game Rooms only).

      NOTE: setting the spectatorCount property manually has no effect on the server and can disrupt the API functioning. This flag depends on the Room state.

    • getMaxSpectators

      int getMaxSpectators()
      Returns the maximum number of spectators allowed in this Room (Game Rooms only).

      NOTE: setting the maxSpectators property manually has no effect on the server and can disrupt the API functioning. This flag must be set when creating the Game Room.

    • getCapacity

      int getCapacity()
      Returns the maximum amount of users, including spectators, that can be contained in this Room.
    • setJoined

      void setJoined(boolean joined)
      Internal
    • setGame

      void setGame(boolean game)
      Internal
    • setHidden

      void setHidden(boolean hidden)
      Internal
    • setManaged

      void setManaged(boolean managed)
      Internal
    • setUserCount

      void setUserCount(int userCount)
      Internal
    • setMaxUsers

      void setMaxUsers(int maxUsers)
      Internal
    • setSpectatorCount

      void setSpectatorCount(int spectatorCount)
      Internal
    • setMaxSpectators

      void setMaxSpectators(int maxSpectators)
      Internal
    • addUser

      void addUser(User user)
      Internal
    • removeUser

      void removeUser(User user)
      Internal
    • containsUser

      boolean containsUser(User user)
      Indicates whether the specified user is currently inside this Room or not.
      Parameters:
      user - The User object representing the user whose presence in this Room must be checked.
      Returns:
      true if the user is inside this Room; false otherwise.
    • getUserByName

      User getUserByName(String name)
      Retrieves a User object from its name property.
      Parameters:
      name - The name of the user to be found.
      Returns:
      The User object representing the user, or null if no user with the passed name exists in this Room.
      See Also:
    • getUserById

      User getUserById(int id)
      Retrieves a User object from its id property.
      Parameters:
      id - The id of the user to be found.
      Returns:
      The User object representing the user, or null if no user with the passed id exists in this Room.
      See Also:
    • getUserList

      List<User> getUserList()
      Returns a list of User objects representing all the users currently inside this Room.
    • getPlayerList

      List<User> getPlayerList()
      Returns a list of User objects representing the players currently inside this Room (Game Rooms only).
    • getSpectatorList

      List<User> getSpectatorList()
      Returns a list of User objects representing the spectators currently inside this Room (Game Rooms only).
    • getVariable

      RoomVariable getVariable(String name)
      Retrieves a Room Variable from its name.
      Parameters:
      name - The name of the Room Variable to be retrieved.
      Returns:
      The RoomVariable object representing the Room Variable, or null if no Room Variable with the passed name exists in this Room.
      See Also:
    • getVariables

      List<RoomVariable> getVariables()
      Retrieves all the Room Variables of this Room.
      Returns:
      The list of RoomVariable objects associated with this Room.
      See Also:
    • setVariable

      void setVariable(RoomVariable roomVariable)
      Internal
    • setVariables

      void setVariables(List<? extends RoomVariable> roomVariables)
      Internal
    • containsVariable

      boolean containsVariable(String name)
      Indicates whether this Room has the specified Room Variable set or not.
      Parameters:
      name - The name of the Room Variable whose existance in this Room must be checked.
      Returns:
      true if a Room Variable with the passed name exists in this Room.
    • getRoomManager

      IRoomManager getRoomManager()
      Returns a reference to the Room Manager which manages this Room.

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

    • setRoomManager

      void setRoomManager(IRoomManager manager) throws SFSException
      Throws:
      SFSException
      Internal
    • isAudioStreamingAllowed

      boolean isAudioStreamingAllowed()
      Indicates whether audio streaming is allowed in the Room.
      Returns:
      true if streaming is allowed
    • setAudioStreamingAllowed

      void setAudioStreamingAllowed(boolean value)
      See Also: