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 Summary
Modifier and TypeMethodDescriptionvoidbooleancontainsUser(User user) Indicates whether the specified user is currently inside this Room or not.booleancontainsVariable(String name) Indicates whether this Room has the specified Room Variable set or not.intReturns the maximum amount of users, including spectators, that can be contained in this Room.Returns the Room Group name.intgetId()The id of this Room.intReturns the maximum number of spectators allowed in this Room (Game Rooms only).intReturns the maximum number of users allowed in this Room.getName()The unique name of this Room.Returns a list of User objects representing the players currently inside this Room (Game Rooms only).Returns a reference to the Room Manager which manages this Room.intReturns the current number of spectators in this Room (Game Rooms only).Returns a list of User objects representing the spectators currently inside this Room (Game Rooms only).getUserById(int id) Retrieves a User object from its id property.getUserByName(String name) Retrieves a User object from its name property.intReturns the current number of users in this Room.Returns a list of User objects representing all the users currently inside this Room.getVariable(String name) Retrieves a Room Variable from its name.Retrieves all the Room Variables of this Room.booleanIndicates whether audio streaming is allowed in the Room.booleanisGame()Indicates whether this is a Game Room or not.booleanisHidden()Indicates whether this Room is hidden or not.booleanisJoined()Indicates whether the client joined this Room or not.booleanbooleanIndicates whether this Room requires a password to be joined or not.voidremoveUser(User user) voidsetAudioStreamingAllowed(boolean value) voidsetGame(boolean game) voidsetHidden(boolean hidden) voidsetJoined(boolean joined) voidsetManaged(boolean managed) voidsetMaxSpectators(int maxSpectators) voidsetMaxUsers(int maxUsers) voidvoidsetPasswordProtected(boolean passwordProtected) voidsetRoomManager(IRoomManager manager) voidsetSpectatorCount(int spectatorCount) voidsetUserCount(int userCount) voidsetVariable(RoomVariable roomVariable) voidsetVariables(List<? extends RoomVariable> roomVariables)
-
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
- 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
- Internal
-
removeUser
- Internal
-
containsUser
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:
trueif the user is inside this Room;falseotherwise.
-
getUserByName
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
nullif no user with the passed name exists in this Room. - See Also:
-
getUserById
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
nullif no user with the passed id exists in this Room. - See Also:
-
getUserList
Returns a list of User objects representing all the users currently inside this Room. -
getPlayerList
Returns a list of User objects representing the players currently inside this Room (Game Rooms only). -
getSpectatorList
Returns a list of User objects representing the spectators currently inside this Room (Game Rooms only). -
getVariable
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
nullif 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
- Internal
-
setVariables
- Internal
-
containsVariable
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:
trueif 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
- 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:
-