|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.gotoandplay.smartfoxserver.data.Room
public class Room
The Room object is responsible for grouping logged users together allowing them to interact with each other and providing high level services such as Room Variables, user count updates, public and private messaging and a lot more.
For a detailed overview of the Room types and features check this tutorial.
| Field Summary | |
|---|---|
java.util.Map |
properties
|
| Constructor Summary | |
|---|---|
Room(java.lang.String name,
int maxUsers,
boolean isTemp,
boolean isGame,
boolean isPrivate,
java.lang.String password,
java.lang.String zone)
Full Constructor |
|
Room(java.lang.String name,
int maxUsers,
boolean isTemp,
java.lang.String zone)
Basic Constructor |
|
| Method Summary | |
|---|---|
boolean |
contains(java.lang.String name)
Check if the room contains a certain user |
boolean |
deleteVariable(java.lang.String vName,
User owner)
|
void |
destroyExtensions()
Destroy all extensions for this room |
User[] |
getAllPlayers()
Return an array of players (for game rooms) |
User[] |
getAllSpectators()
Return an array of all spectators in this room |
User[] |
getAllUsers()
Get all the users in the Room |
User[] |
getAllUsersButOne(java.lang.Integer excludedUserId)
Get an array of Users excluding the one passed to the function This can be useful when you need to broadcast a message to all people in the room except for the one who sent the request to the server. |
User[] |
getAllUsersButOne(User excludedUser)
Get an array of Users excluding the one passed to the function This can be useful when you need to broadcast a message to all people in the room except for the one who sent the request to the server. |
java.util.LinkedList |
getChannellList()
Get a list of the SocketChannels in this room |
java.nio.channels.SocketChannel |
getCreator()
|
it.gotoandplay.smartfoxserver.extensions.ExtensionManager |
getExtManager()
|
int |
getId()
Get room id |
int |
getMaxSpectator()
|
int |
getMaxUsers()
Get the max number of users allowed |
java.lang.String |
getName()
getName() |
java.lang.String |
getPassword()
Get the optional room password |
int |
getSpectatorCount()
|
java.lang.Object[] |
getSpectatorList()
Get an array of spectators in this room |
boolean |
getUcountUpdates()
Get the status of the "uCount" server updates |
User |
getUserByName(java.lang.String userName)
Get a user from its name |
User |
getUserByPlayerIndex(int pid)
Return a player by its player id |
int |
getUserCount()
|
java.lang.Object[] |
getUserList()
Return an array of users |
RoomVariable |
getVariable(java.lang.String varName)
Get a room variable |
java.util.LinkedList |
getVariableNames()
|
java.util.HashMap |
getVariables()
Get a map of variables |
java.lang.String |
getXmlUserList()
|
java.lang.String |
getXmlVariable(java.lang.String varName)
|
java.lang.String |
getXmlVarList()
|
java.lang.String |
getZone()
Get the parent zone |
int |
howManyUsers()
|
boolean |
isGame()
|
boolean |
isLimbo()
|
boolean |
isPrivate()
|
boolean |
isTemp()
|
void |
join(User u,
java.lang.String pwd,
boolean isSpectator)
|
boolean |
removeUser(User u,
boolean updateUserRoomList,
boolean destroyVars)
|
static void |
resetRoomStaticData()
Reset the autoId when the server is restarted |
void |
setCreator(java.nio.channels.SocketChannel ch)
|
void |
setGame()
Set as a game room |
void |
setLimbo(boolean isLimbo)
|
void |
setMaxSpectators(int s)
Set the max number of spectators |
void |
setName(java.lang.String name)
setName() |
void |
setPassword(java.lang.String pw)
Set the room password |
void |
setUcountUpdates(boolean b)
Turn on/off the "uCount" server updates |
boolean |
setVariable(java.lang.String vn,
java.lang.String vt,
java.lang.String vv,
boolean pr,
boolean ps,
User owner,
boolean setOwnership)
|
boolean |
switchPlayer(User u)
|
int |
switchSpectator(User u)
|
void |
updateUserCount()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public java.util.Map properties
| Constructor Detail |
|---|
public Room(java.lang.String name,
int maxUsers,
boolean isTemp,
java.lang.String zone)
name - = room namemaxUsers - = max number of users allowedisTemp - = marks the room as temporary if = true
public Room(java.lang.String name,
int maxUsers,
boolean isTemp,
boolean isGame,
boolean isPrivate,
java.lang.String password,
java.lang.String zone)
name - the room namemaxUsers - max number of users allowed in the roomisTemp - temp roomisGame - game roomisPrivate - private roompassword - an optional passwordzone - the zone name| Method Detail |
|---|
public void destroyExtensions()
public int switchSpectator(User u)
public boolean switchPlayer(User u)
public void setMaxSpectators(int s)
s - public int getMaxSpectator()
public void setUcountUpdates(boolean b)
b - public boolean getUcountUpdates()
public it.gotoandplay.smartfoxserver.extensions.ExtensionManager getExtManager()
public void join(User u,
java.lang.String pwd,
boolean isSpectator)
throws it.gotoandplay.smartfoxserver.exceptions.JoinRoomException
it.gotoandplay.smartfoxserver.exceptions.JoinRoomExceptionpublic java.lang.String getXmlUserList()
public java.lang.Object[] getUserList()
public User getUserByName(java.lang.String userName)
userName - the user name
public java.lang.Object[] getSpectatorList()
public User[] getAllUsers()
public User[] getAllUsersButOne(User excludedUser)
excludedUser - the User object
public User[] getAllUsersButOne(java.lang.Integer excludedUserId)
excludedUserId - the user to exclude (int id)
public User[] getAllPlayers()
public User[] getAllSpectators()
public User getUserByPlayerIndex(int pid)
pid - the player id
public java.lang.String getXmlVarList()
public java.lang.String getXmlVariable(java.lang.String varName)
public java.util.LinkedList getVariableNames()
public java.util.HashMap getVariables()
public RoomVariable getVariable(java.lang.String varName)
varName - the name of the variable
public int getId()
public java.lang.String getZone()
public java.lang.String getPassword()
public java.util.LinkedList getChannellList()
public java.lang.String getName()
public void setName(java.lang.String name)
name - the name of the roompublic boolean isPrivate()
public boolean isTemp()
public boolean isGame()
public void setGame()
public void setPassword(java.lang.String pw)
pw - the passwordpublic int getMaxUsers()
public int getUserCount()
public int getSpectatorCount()
public boolean removeUser(User u,
boolean updateUserRoomList,
boolean destroyVars)
public boolean setVariable(java.lang.String vn,
java.lang.String vt,
java.lang.String vv,
boolean pr,
boolean ps,
User owner,
boolean setOwnership)
public boolean deleteVariable(java.lang.String vName,
User owner)
public void updateUserCount()
public int howManyUsers()
public void setCreator(java.nio.channels.SocketChannel ch)
public java.nio.channels.SocketChannel getCreator()
public boolean contains(java.lang.String name)
name - the user name
public static void resetRoomStaticData()
public boolean isLimbo()
public void setLimbo(boolean isLimbo)
isLimbo - The isLimbo to set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||