public class SFSGame extends SFSRoom
Each game can be configured to match specific types of Users by providing a User Match Expression. The expression contains criteria that
are checked against each User that wants to join the game and provides a mean for filtering players. The Match Expression can check any User Variable plus
a number of other properties exposed in the UserProperties class.
Let's see an example: user Peter has two variables set.
CreateSFSGameSettings| Constructor and Description |
|---|
SFSGame(java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
addUser(User user,
boolean asSpectator) |
int |
getMinPlayersToStartGame()
This is the minimum number of players that are required for the game to start
|
MatchExpression |
getPlayerMatchExpression()
Get the MatchExpression that is going to be checked against any Player joining this Room.
|
MatchExpression |
getSpectatorMatchExpression()
Get the MatchExpression that is going to be checked against any Spectator joining this Room.
|
boolean |
isGameStarted()
Checks if the minimum amount of players to start the game was reached.
|
boolean |
isGameStateChanged()
This is useful for server side events.
|
boolean |
isLeaveLastRoomOnJoin()
A Game can be configured so that when the Player has joined he auto-leaves the previous Room
|
boolean |
isNotifyGameStarted()
The SFSGame can notify the status of the Game (started/not started) via a reserved RoomVariable
|
void |
removeUser(User user) |
void |
setLeaveLastRoomOnJoin(boolean leaveLastRoomOnJoin) |
void |
setMinPlayersToStartGame(int min)
This is not modifiable at runtime.
|
void |
setNotifyGameStarted(boolean notifyGameStarted) |
void |
setPlayerMatchExpression(MatchExpression exp)
This is not modifiable at runtime.
|
void |
setSpectatorMatchExpression(MatchExpression spectatorMatchExpression)
This is not modifiable at runtime.
|
void |
switchPlayerToSpectator(User user) |
void |
switchSpectatorToPlayer(User user) |
java.lang.String |
toString() |
addUser, containsProperty, containsUser, containsUser, containsVariable, destroy, equals, getAdminHelper, getAutoRemoveMode, getCapacity, getDump, getExtension, getGroupId, getId, getLifeTime, getMaxRoomVariablesAllowed, getMaxSpectators, getMaxUsers, getName, getOwner, getPassword, getPlayerIdGeneratorClassName, getPlayersList, getProperties, getProperty, getRoomVariablesData, getSessionList, getSize, getSpectatorsList, getUserById, getUserByName, getUserByPlayerId, getUserBySession, getUserList, getUserListData, getUserManager, getVariable, getVariables, getVariablesCount, getVariablesCreatedByUser, getZone, isActive, isAllowOwnerInvitations, isDynamic, isEmpty, isFlagSet, isFull, isGame, isHidden, isPasswordProtected, isPublic, isUseWordsFilter, removeProperty, removeVariable, removeVariablesCreatedByUser, removeVariablesCreatedByUser, setActive, setAdminHelper, setAllowOwnerInvitations, setAutoRemoveMode, setCapacity, setDynamic, setExtension, setFlag, setFlags, setGame, setGame, setGroupId, setHidden, setMaxRoomVariablesAllowed, setMaxSpectators, setMaxUsers, setName, setOwner, setPassword, setProperties, setProperty, setUserManager, setUseWordsFilter, setVariable, setVariable, setVariables, setVariables, setZone, toSFSArraypublic MatchExpression getPlayerMatchExpression()
MatchExpressionpublic int getMinPlayersToStartGame()
public void setPlayerMatchExpression(MatchExpression exp)
CreateSFSGameSettingspublic MatchExpression getSpectatorMatchExpression()
MatchExpressionpublic void setSpectatorMatchExpression(MatchExpression spectatorMatchExpression)
CreateSFSGameSettingspublic void setMinPlayersToStartGame(int min)
CreateSFSGameSettingspublic boolean isLeaveLastRoomOnJoin()
public void setLeaveLastRoomOnJoin(boolean leaveLastRoomOnJoin)
public boolean isNotifyGameStarted()
ReservedRoomVariables.RV_GAME_STARTEDpublic void setNotifyGameStarted(boolean notifyGameStarted)
public boolean isGameStarted()
public boolean isGameStateChanged()
public void addUser(User user, boolean asSpectator) throws SFSJoinRoomException
SFSRoomaddUser in interface RoomaddUser in class SFSRoomSFSJoinRoomExceptionpublic void removeUser(User user)
SFSRoomremoveUser in interface RoomremoveUser in class SFSRoompublic void switchPlayerToSpectator(User user) throws SFSRoomException
SFSRoomswitchPlayerToSpectator in interface RoomswitchPlayerToSpectator in class SFSRoomSFSRoomExceptionpublic void switchSpectatorToPlayer(User user) throws SFSRoomException
SFSRoomswitchSpectatorToPlayer in interface RoomswitchSpectatorToPlayer in class SFSRoomSFSRoomException