public class SFSUser extends java.lang.Object implements User
Also each User provides a number of essential services:
| Constructor and Description |
|---|
SFSUser(ISession session) |
SFSUser(java.lang.String name,
ISession session) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCreatedRoom(Room room) |
void |
addJoinedRoom(Room room) |
void |
addPersistentRoomVarReference(Room target) |
boolean |
containsProperty(java.lang.Object key)
Checks whether a custom property exists or not
|
boolean |
containsVariable(java.lang.String varName)
Checks whether or not the User has a specific UserVariable
|
void |
disconnect(IDisconnectionReason reason) |
boolean |
equals(java.lang.Object obj) |
com.smartfoxserver.v2.util.IAdminHelper |
getAdminHelper() |
int |
getBadWordsWarnings() |
BuddyProperties |
getBuddyProperties()
Get the BuddyProperty object
|
Country |
getCountry()
If the geolocation service is enabled in the Zone it will return the location of the user
|
java.util.List<Room> |
getCreatedRooms()
Get a list of Rooms created by this User
|
MMORoom |
getCurrentMMORoom() |
java.lang.String |
getDump()
Return a full dump of the User properties, useful for debugging
|
int |
getFloodWarnings() |
int |
getId()
Get the unique user ID
|
java.lang.String |
getIpAddress()
Return the User IP address
|
java.util.List<Room> |
getJoinedRooms()
A list of Rooms currently joined by the User
|
Room |
getLastJoinedRoom()
A reference to the last Room that was joined by this User
|
long |
getLastLoginTime() |
java.util.List<BaseMMOItem> |
getLastMMOItemsList() |
java.util.List<User> |
getLastProxyList() |
long |
getLastRequestTime() |
long |
getLoginTime()
Get the user login time (Unix timestamp)
|
int |
getMaxAllowedVariables()
Get the maximum allowed User Variables for this User
|
java.lang.String |
getName()
Get the User name
|
int |
getOwnedRoomsCount()
Get the number of Rooms created by the User
|
java.util.Set<java.lang.Integer> |
getPersistentRoomVarReferences() |
int |
getPlayerId()
Get the playerId of the User (if applicable).
|
int |
getPlayerId(Room room)
Get the playerId for the User in a specific Room
|
java.util.Map<Room,java.lang.Integer> |
getPlayerIds()
Get a map of playerId(s) per Room
This method can be used when a player is currently engaged in multiple games at the same time |
short |
getPrivilegeId()
Return the Privilege ID of the User.
|
java.util.concurrent.ConcurrentMap<java.lang.Object,java.lang.Object> |
getProperties()
Get the map with all User properties
|
java.lang.Object |
getProperty(java.lang.Object key)
Get any custom property attached to this User.
|
int |
getReconnectionSeconds() |
ISession |
getSession()
Get the session object linked to this User
|
java.util.List<java.lang.String> |
getSubscribedGroups()
Get a list of Room Groups subscribed by the User
|
ISFSArray |
getUserVariablesData() |
UserVariable |
getVariable(java.lang.String varName)
Return a UserVariable.
|
java.util.List<UserVariable> |
getVariables()
Obtain the full list of UserVariables
|
int |
getVariablesCount()
Return the number of UserVariables for this User
|
Zone |
getZone()
Get the Zone where the User is currently logged in
|
boolean |
isBeingKicked() |
boolean |
isConnected()
Check if the User is connected
|
boolean |
isJoinedInRoom(Room room)
Check if a User is joined in a Room
|
boolean |
isJoining() |
boolean |
isLocal()
Returns true if the User is connected to the local cluster node
|
boolean |
isNpc()
Returns the NPC flag
|
boolean |
isPlayer()
Check if the User is a Player in the current Room (only for Game Rooms)
|
boolean |
isPlayer(Room room)
Check if the User is Player in a specific Room
|
boolean |
isSpectator()
Check if the User is a Spectator in the current Room (only for Game Rooms)
|
boolean |
isSpectator(Room room)
Check if the User is Spectator in a specific Room
|
boolean |
isSubscribedToGroup(java.lang.String id)
Check if the User is subscribed to a certain Room Group
|
boolean |
isSuperUser()
Check if the User has SuperUser capabilities (kicking/banning etc...)
|
void |
removeCreatedRoom(Room room) |
void |
removeJoinedRoom(Room room) |
void |
removeProperty(java.lang.Object key)
Removes a custom property
|
void |
removeVariable(java.lang.String varName) |
void |
setAdminHelper(com.smartfoxserver.v2.util.IAdminHelper adminHelper) |
void |
setBadWordsWarnings(int badWordsWarnings) |
void |
setBeingKicked(boolean flag) |
void |
setConnected(boolean flag) |
void |
setFloodWarnings(int floodWarnings) |
void |
setJoining(boolean flag) |
void |
setLastLoginTime(long lastLoginTime) |
void |
setLastMMOItemsList(java.util.List<BaseMMOItem> mmoItemsList) |
void |
setLastProxyList(java.util.List<User> proxyList) |
void |
setLastRequestTime(long lastRequestTime) |
void |
setMaxAllowedVariables(int max) |
void |
setName(java.lang.String name)
DO NOT use this method
User names cannot be changed at runtime: they are unique and decided at login time exclusively.
|
void |
setPlayerId(int id,
Room room) |
void |
setPrivilegeId(short id) |
void |
setProperty(java.lang.Object key,
java.lang.Object val)
Attach a custom (server-side only) property to the User object
|
void |
setReconnectionSeconds(int seconds) |
void |
setVariable(UserVariable var) |
void |
setVariables(java.util.List<UserVariable> userVariables) |
void |
setZone(Zone currentZone) |
void |
subscribeGroup(java.lang.String id) |
ISFSArray |
toSFSArray() |
ISFSArray |
toSFSArray(Room room) |
java.lang.String |
toString() |
void |
unsubscribeGroup(java.lang.String id) |
void |
updateLastRequestTime() |
public SFSUser(ISession session)
public SFSUser(java.lang.String name,
ISession session)
public BuddyProperties getBuddyProperties()
UsergetBuddyProperties in interface Userpublic int getId()
Userpublic short getPrivilegeId()
UsergetPrivilegeId in interface Userpublic void setPrivilegeId(short id)
setPrivilegeId in interface Userpublic boolean isSuperUser()
UserisSuperUser in interface Userpublic boolean isConnected()
UserisConnected in interface Userpublic boolean isLocal()
Userpublic void setConnected(boolean flag)
setConnected in interface Userpublic void setJoining(boolean flag)
setJoining in interface Userpublic java.lang.String getIpAddress()
UsergetIpAddress in interface Userpublic int getMaxAllowedVariables()
UsergetMaxAllowedVariables in interface Userpublic void setMaxAllowedVariables(int max)
setMaxAllowedVariables in interface Userpublic void addCreatedRoom(Room room)
addCreatedRoom in interface Userpublic java.util.List<Room> getCreatedRooms()
UsergetCreatedRooms in interface Userpublic void removeCreatedRoom(Room room)
removeCreatedRoom in interface Userpublic void addJoinedRoom(Room room)
addJoinedRoom in interface Userpublic void removeJoinedRoom(Room room)
removeJoinedRoom in interface Userpublic int getOwnedRoomsCount()
UsergetOwnedRoomsCount in interface Userpublic void subscribeGroup(java.lang.String id)
subscribeGroup in interface Userpublic void unsubscribeGroup(java.lang.String id)
unsubscribeGroup in interface Userpublic java.util.List<java.lang.String> getSubscribedGroups()
UsergetSubscribedGroups in interface Userpublic boolean isSubscribedToGroup(java.lang.String id)
UserisSubscribedToGroup in interface Userid - the id of the grouppublic void disconnect(IDisconnectionReason reason)
disconnect in interface Userpublic boolean isNpc()
Userpublic java.util.List<Room> getJoinedRooms()
UsergetJoinedRooms in interface Userpublic Zone getZone()
Userpublic Room getLastJoinedRoom()
UsergetLastJoinedRoom in interface Userpublic boolean isJoinedInRoom(Room room)
UserisJoinedInRoom in interface Userroom - the Roompublic long getLoginTime()
UsergetLoginTime in interface Userpublic void setLastLoginTime(long lastLoginTime)
setLastLoginTime in interface Userpublic java.lang.String getName()
Userpublic void setName(java.lang.String name)
Userpublic int getPlayerId()
UsergetPlayerId in interface Userpublic int getPlayerId(Room room)
UsergetPlayerId in interface UserUser.getPlayerId()public java.util.Map<Room,java.lang.Integer> getPlayerIds()
UsergetPlayerIds in interface UserUser.getPlayerId()public void setPlayerId(int id,
Room room)
setPlayerId in interface Userpublic boolean isPlayer()
Userpublic boolean isSpectator()
UserisSpectator in interface Userpublic boolean isPlayer(Room room)
Userpublic boolean isSpectator(Room room)
UserisSpectator in interface Userroom - the rooompublic java.lang.Object getProperty(java.lang.Object key)
UsergetProperty in interface Userpublic java.util.concurrent.ConcurrentMap<java.lang.Object,java.lang.Object> getProperties()
UsergetProperties in interface Userpublic void setProperty(java.lang.Object key,
java.lang.Object val)
UsersetProperty in interface Userkey - the property nameval - the property valuepublic boolean containsProperty(java.lang.Object key)
UsercontainsProperty in interface Userkey - the name of the propertypublic void removeProperty(java.lang.Object key)
UserremoveProperty in interface Userkey - the name of the propertypublic ISession getSession()
UsergetSession in interface Userpublic int getVariablesCount()
UsergetVariablesCount in interface Userpublic UserVariable getVariable(java.lang.String varName)
UsergetVariable in interface UservarName - the name of the variablepublic void setVariable(UserVariable var) throws SFSVariableException
setVariable in interface UserSFSVariableExceptionpublic void setVariables(java.util.List<UserVariable> userVariables) throws SFSVariableException
setVariables in interface UserSFSVariableExceptionpublic boolean containsVariable(java.lang.String varName)
UsercontainsVariable in interface UservarName - the name of the variablepublic java.util.List<UserVariable> getVariables()
UsergetVariables in interface Userpublic void removeVariable(java.lang.String varName)
removeVariable in interface Userpublic java.lang.String toString()
toString in class java.lang.Objectpublic long getLastRequestTime()
getLastRequestTime in interface Userpublic void updateLastRequestTime()
updateLastRequestTime in interface Userpublic void setLastRequestTime(long lastRequestTime)
setLastRequestTime in interface Userpublic int getBadWordsWarnings()
getBadWordsWarnings in interface Userpublic void setBadWordsWarnings(int badWordsWarnings)
setBadWordsWarnings in interface Userpublic int getFloodWarnings()
getFloodWarnings in interface Userpublic void setFloodWarnings(int floodWarnings)
setFloodWarnings in interface Userpublic long getLastLoginTime()
public boolean isBeingKicked()
isBeingKicked in interface Userpublic void setBeingKicked(boolean flag)
setBeingKicked in interface Userpublic ISFSArray getUserVariablesData()
getUserVariablesData in interface Userpublic int getReconnectionSeconds()
getReconnectionSeconds in interface Userpublic void setReconnectionSeconds(int seconds)
setReconnectionSeconds in interface Userpublic ISFSArray toSFSArray(Room room)
toSFSArray in interface Userpublic ISFSArray toSFSArray()
toSFSArray in interface Userpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String getDump()
Userpublic com.smartfoxserver.v2.util.IAdminHelper getAdminHelper()
public void setAdminHelper(com.smartfoxserver.v2.util.IAdminHelper adminHelper)
public java.util.List<User> getLastProxyList()
getLastProxyList in interface Userpublic void setLastProxyList(java.util.List<User> proxyList)
setLastProxyList in interface Userpublic java.util.List<BaseMMOItem> getLastMMOItemsList()
getLastMMOItemsList in interface Userpublic void setLastMMOItemsList(java.util.List<BaseMMOItem> mmoItemsList)
setLastMMOItemsList in interface Userpublic MMORoom getCurrentMMORoom()
getCurrentMMORoom in interface Userpublic Country getCountry()
UsergetCountry in interface Userpublic void addPersistentRoomVarReference(Room target)
addPersistentRoomVarReference in interface Userpublic java.util.Set<java.lang.Integer> getPersistentRoomVarReferences()
getPersistentRoomVarReferences in interface User