Class ClusterRoomSettings
- java.lang.Object
-
- sfs2x.client.requests.RoomSettings
-
- sfs2x.client.requests.cluster.ClusterRoomSettings
-
public class ClusterRoomSettings extends RoomSettings
The ClusterRoomSettings class is a container for the settings required to create a Room in an SFS2X ClusterA ClusterRoom can be used both for hosting games, chats or other user interactions and have several attributes
- public/private: allows players to join freely via match-making or instead join via invitation only
- minPlayersToStartGame: minimum number of players to trigger the start of the game
- invitedPlayers: a list of Users that will receive an invitation to join the Room
- notifyGameStarted: signal all players that the min. number of players has been reached and the game can start
- See Also:
- overcast.smartfoxserver.com,
CreateRoomRequest
,*
-
-
Constructor Summary
Constructors Constructor Description ClusterRoomSettings(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getInvitationExpiryTime()
In private games, defines the number of seconds that the users invited to join the game have to reply to the invitation.com.smartfoxserver.v2.entities.data.ISFSObject
getInvitationParams()
In private games, defines an optional object containing additional custom parameters to be sent together with the invitation.java.util.List<?>
getInvitedPlayers()
In private games, defines a list of User objects representing players to be invited to join the game.int
getMinPlayersToStartGame()
Defines the minimum number of players required to start the game.boolean
getNotifyGameStarted()
Indicates if a game state change must be notified when the minimum number of players is reached.boolean
isPublic()
Indicates whether the game is public or private.void
setInvitationExpiryTime(int invitationExpiryTime)
void
setInvitationParams(com.smartfoxserver.v2.entities.data.ISFSObject invitationParams)
void
setInvitedPlayers(java.util.List<?> invitedPlayers)
void
setMinPlayersToStartGame(int minPlayersToStartGame)
void
setNotifyGameStarted(boolean notifyGameStarted)
void
setPublic(boolean isPublic)
-
Methods inherited from class sfs2x.client.requests.RoomSettings
allowOwnerOnlyInvitation, getEvents, getExtension, getGroupId, getMaxSpectators, getMaxUsers, getMaxVariables, getName, getPassword, getPermissions, getVariables, isGame, setAllowOwnerOnlyInvitation, setEvents, setExtension, setGame, setGroupId, setMaxSpectators, setMaxUsers, setMaxVariables, setName, setPassword, setPermissions, setVariables
-
-
-
-
Method Detail
-
isPublic
public boolean isPublic()
Indicates whether the game is public or private.A public game can be joined by any player whose User Variables match the playerMatchExpression assigned to the Game Room. A private game can be joined by users invited by the game creator by means of invitedPlayers list.
The default value istrue
.- See Also:
#getPlayerMatchExpression()
,getInvitedPlayers()
-
getMinPlayersToStartGame
public int getMinPlayersToStartGame()
Defines the minimum number of players required to start the game. If the notifyGameStarted property is set totrue
, when this number is reached, the game start is notified. The default value is2
.- See Also:
getNotifyGameStarted()
-
getInvitedPlayers
public java.util.List<?> getInvitedPlayers()
In private games, defines a list of User objects representing players to be invited to join the game.If the invitations are less than the minimum number of players required to start the game (see the minPlayersToStartGame property), the server will send additional invitations automatically, searching users in the Room Groups specified in the searchableRooms list and filtering them by means of the object passed to the playerMatchExpression property.
The game matching criteria contained in the playerMatchExpression property do not apply to the users specified in this list.
The default value isnull
.- See Also:
minPlayersToStartGame
,#searchableRooms
,#playerMatchExpression
,User
-
getInvitationExpiryTime
public int getInvitationExpiryTime()
In private games, defines the number of seconds that the users invited to join the game have to reply to the invitation. The suggested range is 30 to 60 seconds. The default value is40
.
-
getNotifyGameStarted
public boolean getNotifyGameStarted()
Indicates if a game state change must be notified when the minimum number of players is reached.If this setting is
true
, the game state (started or stopped) is handled by means of the reserved Room Variable represented by the ReservedRoomVariables.RV_GAME_STARTED constant. Listening to the roomVariablesUpdate event for this variable allows clients to be notified when the game can start due to minimum number of players being reached.As the used Room Variable is created as global (see the SFSRoomVariable class description), its update is broadcast outside the Room too: this can be used on the client-side, for example, to show the game state in a list of available games.
The default value isfalse
.
-
getInvitationParams
public com.smartfoxserver.v2.entities.data.ISFSObject getInvitationParams()
In private games, defines an optional object containing additional custom parameters to be sent together with the invitation.This object must be an instance of SFSObject. Possible custom parameters to be transferred to the invitees are a message for the recipient, the game details (title, type...), the inviter details, etc.
The default value isnull
.- See Also:
SFSObject
-
setPublic
public void setPublic(boolean isPublic)
- See Also:
isPublic()
-
setMinPlayersToStartGame
public void setMinPlayersToStartGame(int minPlayersToStartGame)
- See Also:
getMinPlayersToStartGame()
-
setInvitedPlayers
public void setInvitedPlayers(java.util.List<?> invitedPlayers)
- See Also:
getInvitedPlayers()
-
setInvitationExpiryTime
public void setInvitationExpiryTime(int invitationExpiryTime)
- See Also:
getInvitationExpiryTime()
-
setNotifyGameStarted
public void setNotifyGameStarted(boolean notifyGameStarted)
- See Also:
getNotifyGameStarted()
-
setInvitationParams
public void setInvitationParams(com.smartfoxserver.v2.entities.data.ISFSObject invitationParams)
- See Also:
getInvitationParams()
-
-