|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface User
The User interface defines all the methods and properties that an object representing a SmartFoxServer User entity exposes.
In the SmartFoxServer 2X client API this interface is implemented by the SFSUser class. Read the class description for additional informations.
SFSUser| Method Summary | |
|---|---|
boolean |
containsVariable(java.lang.String name)
Indicates whether this user has the specified User Variable set or not. |
int |
getId()
Indicates the id of this user. |
java.lang.String |
getName()
Indicates the name of this user. |
int |
getPlayerId()
Returns the id of this user as a player in a Game Room. |
int |
getPlayerId(Room room)
Returns the playerId value of this user in the passed Room. |
int |
getPrivilegeId()
Returns the id which identifies the privilege level of this user. |
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Defines a generic utility object that can be used to store custom user data. |
IUserManager |
getUserManager()
*Private* |
UserVariable |
getVariable(java.lang.String varName)
Retrieves a User Variable from its name. |
java.util.List<UserVariable> |
getVariables()
Retrieves all the User Variables of this user. |
boolean |
isAdmin()
Indicates whether this user logged in as an administrator or not. |
boolean |
isGuest()
Indicates whether this user logged in as a guest or not. |
boolean |
isItMe()
Indicates if this User object represents the current client. |
boolean |
isJoinedInRoom(Room room)
Indicates whether this user joined the passed Room or not. |
boolean |
isModerator()
Indicates whether this user logged in as a moderator or not. |
boolean |
isPlayer()
Indicates whether this user is a player (playerId greater than 0) in the last joined Room or not. |
boolean |
isPlayerInRoom(Room room)
Indicates whether this user is a player (playerId greater than 0) in the passed Room or not. |
boolean |
isSpectator()
Indicates whether this user is a spectator (playerId lower than 0) in the last joined Room or not. |
boolean |
isSpectatorInRoom(Room room)
Indicates whether this user is a spectator (playerId lower than 0) in the passed Room or not. |
boolean |
isStandardUser()
Indicates whether this user logged in as a standard user or not. |
void |
removePlayerId(Room room)
*Private* |
void |
setPlayerId(int id,
Room room)
*Private* |
void |
setPrivilegeId(int privilegeId)
Returns a reference to the User Manager which manages this user. |
void |
setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
*Private* |
void |
setUserManager(IUserManager userManager)
|
void |
setVariable(UserVariable userVariable)
*Private* |
void |
setVariables(java.util.List<? extends UserVariable> userVariables)
*Private* |
| Method Detail |
|---|
int getId()
java.lang.String getName()
int getPlayerId()
This property differs from id property and it used to indicate which player number is assigned to a user inside a Game Room.
For example, in a Game Room for 5 players the first client joining it will have playerId equal to 1, the second will have it equal to 2 and so forth.
When a user leaves the Room the player slot is freed up and the next user joining the Room will take it.
The playerId property applies to Game Rooms only; in standard Rooms it is always 0.
Also, in Game Rooms a playerId value lower than 0 indicates that the user is a spectator.
If the user is inside multiple Game Rooms at the same time, a different playerId value will be assigned to him in each Room. In this case this property returns the value corresponding to the last joined Room; in order to obtain the playerId value in a specific Room, use the getPlayerId() method.
getPlayerId(Room)boolean isPlayer()
0) in the last joined Room or not.
Non-Game Rooms always return false.
If the user is inside multiple Game Rooms at the same time, use the isPlayerInRoom() method.
isPlayerInRoom(sfs2x.client.entities.Room),
getPlayerId(),
isSpectator()boolean isSpectator()
0) in the last joined Room or not.
Non-Game Rooms always return false.
If the user is inside multiple Game Rooms at the same time, use the isSpectatorInRoom() method.
isSpectatorInRoom(sfs2x.client.entities.Room),
getPlayerId(),
isPlayer()int getPlayerId(Room room)
room - The Room object representing the Room to retrieve the player id from.
getPlayerId()
void setPlayerId(int id,
Room room)
void removePlayerId(Room room)
int getPrivilegeId()
NOTE: setting the privilegeId property manually has no effect on the server and can disrupt the API functioning. Privileges are assigned to the user by the server when the user logs in.
UserPrivilegesvoid setPrivilegeId(int privilegeId)
NOTE: setting the userManager property manually has no effect on the server and can disrupt the API functioning.
IUserManager getUserManager()
void setUserManager(IUserManager userManager)
boolean isGuest()
true if this user is a guest.isStandardUser(),
isModerator(),
isAdmin(),
getPrivilegeId(),
UserPrivileges.GUESTboolean isStandardUser()
true if this user is a standard user.isGuest(),
isModerator(),
isAdmin(),
getPrivilegeId(),
UserPrivileges.STANDARDboolean isModerator()
true if this user is a moderator.isGuest(),
isStandardUser(),
isAdmin(),
getPrivilegeId(),
UserPrivileges.MODERATORboolean isAdmin()
true if this user is an administrator.isGuest(),
isStandardUser(),
isModerator(),
getPrivilegeId(),
UserPrivileges.ADMINISTRATORboolean isPlayerInRoom(Room room)
0) in the passed Room or not.
Non-Game Rooms always return false.
If a user can join one Game Rooms at a time only, use the isPlayer property.
room - The Room object representing the Room where to check if this user is a player.
true if this user is a player in the passed Room.isPlayer(),
isSpectatorInRoom(Room),
getPlayerId()boolean isSpectatorInRoom(Room room)
0) in the passed Room or not.
Non-Game Rooms always return false.
If a user can join one Game Rooms at a time only, use the isSpectator property.
room - The Room object representing the Room where to check if this user is a spectator.
true if this user is a spectator in the passed Room.isSpectator(),
isPlayerInRoom(Room),
getPlayerId()boolean isJoinedInRoom(Room room)
room - The Room object representing the Room where to check the user presence.
true if this user is inside the passed Room.boolean isItMe()
SmartFox.getMySelf()java.util.List<UserVariable> getVariables()
UserVariable,
getVariable(String)UserVariable getVariable(java.lang.String varName)
varName - The name of the User Variable to be retrieved.
null if no User Variable with the passed name is associated with this user.getVariables(),
SetUserVariablesRequestvoid setVariable(UserVariable userVariable)
void setVariables(java.util.List<? extends UserVariable> userVariables)
boolean containsVariable(java.lang.String name)
name - The name of the User Variable whose existance must be checked.
true if a User Variable with the passed name is set for this user.java.util.Map<java.lang.String,java.lang.Object> getProperties()
void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||