Interface Zone
-
- All Known Implementing Classes:
SFSZone
public interface Zone
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddDisabledSystemEvent(java.lang.String eventID)INTERNALvoidaddRoom(Room room)INTERNALvoidchangeRoomCapacity(Room room, int newMaxUsers, int maxMaxSpect)INTERNALvoidchangeRoomName(Room room, java.lang.String newName)INTERNALvoidchangeRoomPasswordState(Room room, java.lang.String password)INTERNALvoidcheckAndRemove(Room room)booleancontainsGroup(java.lang.String groupId)Check if the Zone contains the specified GroupbooleancontainsProperty(java.lang.Object key)Checks the existance of a Zone propertybooleancontainsPublicGroup(java.lang.String groupId)Check if the Zone contains the specified public GroupRoomcreateRoom(CreateRoomSettings params)RoomcreateRoom(CreateRoomSettings params, User user)BuddyListManagergetBuddyListManager()INTERNALIDBManagergetDBManager()Obtain a reference to the Zone's Database Manager.java.util.List<java.lang.String>getDefaultGroups()Get the list of Groups that each User will be automatically subscribed to when joining the Zone.java.lang.StringgetDefaultPlayerIdGeneratorClassName()java.lang.StringgetDump()ISFSExtensiongetExtension()INTERNALISystemFilterChaingetFilterChain(SystemRequest requestId)Obtain a reference to the Zone's SystemFilterChain.IFloodFiltergetFloodFilter()INTERNALintgetGameRoomCount()java.util.Set<SFSRoomEvents>getGroupEvents(java.lang.String groupId)java.util.List<java.lang.String>getGroups()Get the full list of Room Groups available in the Zone.java.lang.StringgetGuestUserNamePrefix()Get the prefix used by the system to auto-generate guest user names.intgetId()A numeric ID used by the AdminTool.intgetMaxAllowedRooms()The maximum number of Rooms that can be created in the Room.intgetMaxAllowedUsers()The maximum number of users allowed to join the Zone.intgetMaxFailedLogins()The max number of login attempts (in the same session) a user can fail before being disconnected.intgetMaxFindRoomResults()Get the max number of "FindRoom" results for a client request.intgetMaxFindUserResults()Get the max number of "Find User" results for a client request.intgetMaxInvitationsPerRequest()Get the max number of people that can be invited a by a single client side JoinRoomInvitationRequestintgetMaxRoomNameChars()The maximum number of characters allowed for a Room nameintgetMaxRoomsCreatedPerUserLimit()The maximum number of Rooms that a User can create at once.intgetMaxRoomVariablesAllowed()The maximum number of Room Variables allowed for each Room.intgetMaxUserIdleTime()Get the max allowed idle time for a User.intgetMaxUserVariablesAllowed()The maximum number of User Variables allowed for each User.intgetMinRoomNameChars()The minimum number of characters allowed for Room namejava.lang.StringgetName()The name of the Zone.PrivilegeManagergetPrivilegeManager()java.lang.ObjectgetProperty(java.lang.Object key)Properties are custom values that can be added or removed from the Zone at run-time.java.util.List<java.lang.String>getPublicGroups()Get a list of names of the "Public" Room Groups available in the Zone.RoomgetRoomById(int id)Get a Room from its unique IDRoomgetRoomByName(java.lang.String name)Get a Room from its namejava.util.List<Room>getRoomList()Get the list of Rooms in the ZoneISFSArraygetRoomListData()INTERNALISFSArraygetRoomListData(java.util.List<java.lang.String> groupIds)INTERNALjava.util.List<Room>getRoomListFromGroup(java.lang.String groupId)Get the list of Rooms from a specific Groupjava.util.List<Room>getRoomListFromGroupList(java.util.Collection<java.lang.String> groups)Obtain a Room list generated by merging all Rooms from the provided group namescom.smartfoxserver.v2.entities.managers.IRoomManagergetRoomManager()Obtain a reference to the internal Room ManagerIRoomStoragegetRoomPersistenceApi()Obtain the Room Persistence API object.java.util.Collection<ISession>getSessionList()Get the list of Sessions logged in the Zonejava.util.Collection<ISession>getSessionsInGroup(java.lang.String groupId)Get a list of Sessions from all Rooms in the provided Room Groupjava.util.Collection<ISession>getSessionsListeningToGroup(java.lang.String groupId)Get a list of Sessions listening for events in a specific GroupintgetTotalRoomCount()com.smartfoxserver.v2.util.IResponseThrottlergetUCountThrottler()INTERNALUsergetUserById(int id)Get a User from its unique IDUsergetUserByName(java.lang.String name)Get a User from its nameUsergetUserBySession(ISession session)Get a User from its Session objectintgetUserCount()Get the current amount of Users connected to the ZoneintgetUserCountChangeUpdateInterval()Get the rate (in ms.) at which the UserCountUpdates events are fired to the clients.java.util.Collection<User>getUserList()Get the list of Users logged in the Zonecom.smartfoxserver.v2.entities.managers.IUserManagergetUserManager()intgetUserReconnectionSeconds()Return the amount of seconds available for a User to reconnect to the system in case their socket connection goes down.java.util.Collection<User>getUsersInGroup(java.lang.String groupId)Get a list of Users from all Rooms in the provided Room GroupIWordFiltergetWordFilter()INTERNALcom.smartfoxserver.v2.entities.managers.IZoneManagergetZoneManager()voidinitRoomPersistence(RoomStorageMode mode, BaseStorageConfig config)Initializes the Room Persistence functionality.booleanisActive()Checks if the Zone is currently enabled in the system or not.booleanisAllowInvitationsOnlyForBuddies()True if only buddies can be invited by a client side JoinRoomInvitationRequest, false otherwise.booleanisClientAllowedToOverridRoomEvents()booleanisCustomLogin()Check if the Zone fires LOGIN events to the Zone extension at login time.booleanisEncrypted()True if protocol cryptography is turned on in this Zone.booleanisFilterBuddyMessages()Toggle the filtering of Buddy messages via the Words Filter.booleanisFilterChainInited()Returns true if the FilterChain was initializedbooleanisFilterPrivateMessages()If turned on the Zone will apply the Words Filter to private messagesbooleanisFilterRoomNames()If turned on the Zone will apply the Words Filter to Room namesbooleanisFilterUserNames()If turned on the Zone will apply the Words Filter to User names provided at login timebooleanisForceLogout()If turned on it allows a User to connect from another location while another connection is already active.booleanisGeoLocationEnabled()Toggles geolocation for clients.booleanisGroupEventSet(java.lang.String groupId, SFSRoomEvents eventToCheck)Checks whether a specific Room Event for the specified Group is activebooleanisGuestUserAllowed()Check if the Zone allows guest users (those sending no name and no password).booleanisHidden()INTERNALbooleanisLagMonitorKeepAlive()Returns true if the LagMonitor requests are also actively resetting the User's idle timerbooleanisSystemEventAllowed(java.lang.String eventID)INTERNALbooleanisUploadEnabled()True if the Zone supports HTTP uploads.Userlogin(LoginData loginData)INTERNALvoidregisterEventsForRoomGroup(java.lang.String groupId, java.util.Set<SFSRoomEvents> flags)voidremoveAllUsers()voidremoveDisabledSystemEvent(java.lang.String eventID)INTERNALvoidremoveProperty(java.lang.Object key)Remove a property.voidremoveRoom(int roomId)INTERNALvoidremoveRoom(Room room)INTERNALvoidremoveRoom(java.lang.String name)INTERNALvoidremoveUser(int userId)INTERNALvoidremoveUser(ISession session)INTERNALvoidremoveUser(User user)INTERNALvoidremoveUser(java.lang.String userName)INTERNALvoidremoveUserFromRoom(User user, Room room)INTERNALvoidresetSystemFilterChain()Resets the whole SystemController Filter chain.voidsetActive(boolean flag)Changes the state of the Zone.voidsetAllowInvitationsOnlyForBuddies(boolean allowInvitationsOnlyForBuddies)Set to true if only buddies can be invited by a client side JoinRoomInvitationRequest, false otherwise.voidsetBuddyListManager(BuddyListManager buddyListManager)INTERNALvoidsetClientAllowedToOverridRoomEvents(boolean flag)voidsetCustomLogin(boolean flag)Set the Zone as Custom login.voidsetDBManager(IDBManager manager)INTERNALvoidsetDefaultGroups(java.util.List<java.lang.String> groupIDs)voidsetDefaultPlayerIdGeneratorClassName(java.lang.String className)voidsetEncrypted(boolean value)Toggles the protocol cryptography.voidsetExtension(ISFSExtension extension)INTERNALvoidsetFilterBuddyMessages(boolean flag)If turned on the Zone will apply the Words Filter to Buddy messagesvoidsetFilterChain(SystemRequest requestId, ISystemFilterChain chain)Set a SystemFilterChain for a specific SystemController's Request.voidsetFilterPrivateMessages(boolean flag)Toggle the filtering of private messages via the Words Filter.voidsetFilterRoomNames(boolean flag)Toggle the filtering of Room names via the Words Filter.voidsetFilterUserNames(boolean flag)Toggle the filtering of User names via the Words Filter at login time.voidsetForceLogout(boolean flag)If turned on it allows a User to connect from another location while another connection is already active.voidsetGeoLocationEnabled(boolean value)Toggles geolocation for clients.voidsetGuestUserAllowed(boolean flag)Toggles the Zone guest users (login with no name and no password).voidsetGuestUserNamePrefix(java.lang.String prefix)Set the prefix used by the system to auto-generate guest user names.voidsetHidden(boolean flag)INTERNALvoidsetId(int id)A numeric ID used by the AdminTool.voidsetLagMonitorKeepAlive(boolean value)Resets the the Users' idle timer for every client side LagMonitor request, when set to true;voidsetMaxAllowedRooms(int max)Set the maximum number of Rooms that can be created in the Room.voidsetMaxAllowedUsers(int max)Set the maximum number of users allowed to join the Zone.voidsetMaxFailedLogins(int value)Set the max number of login attempts (in the same session) a user can fail before being disconnected.voidsetMaxFindRoomResults(int value)Set the max number of "FindRoom" results for a client request.voidsetMaxFindUserResults(int value)Set the max number of "FindUser" results for a client request.voidsetMaxInvitationsPerRequest(int maxInvitationsPerRequest)Set the max number of people that can be invited a by a single client side JoinRoomInvitationRequestvoidsetMaxRoomNameChars(int max)Set the maximum number of characters allowed for a Room namevoidsetMaxRoomsCreatedPerUserLimit(int max)Set the maximum number of Rooms that a User can create at once.voidsetMaxRoomVariablesAllowed(int max)Set the maximum number of Room variables allowed in the RoomvoidsetMaxUserIdleTime(int seconds)Set the max allowed idle time for a User.voidsetMaxUserVariablesAllowed(int max)Set the maximum number of User Variables allowed for each User.voidsetMinRoomNameChars(int min)Set the minimum number of characters allowed for a Room namevoidsetPrivilegeManager(PrivilegeManager privilegeManager)voidsetProperty(java.lang.Object key, java.lang.Object value)Properties are custom values that can be added or removed from the Zone at run-time.voidsetPublicGroups(java.util.List<java.lang.String> groupIDs)voidsetUploadEnabled(boolean val)Switches on/off the ability to upload data via HTTP.voidsetUserCountChangeUpdateInterval(int interval)Set the rate (in ms.) at which the UserCountUpdates events are fired to the clients.voidsetUserReconnectionSeconds(int seconds)Set the amount of seconds available for a User to reconnect to the system in case their socket connection goes down.voidsetZoneManager(com.smartfoxserver.v2.entities.managers.IZoneManager manager)voidvalidateUserName(java.lang.String name)
-
-
-
Method Detail
-
getUserManager
com.smartfoxserver.v2.entities.managers.IUserManager getUserManager()
-
isActive
boolean isActive()
Checks if the Zone is currently enabled in the system or not. Inactive Zones won't allow anyone to login. You can deactivate a Zone at runtime (from the AdminTool) if you are planning to remove it. All Users will be disconnected.- Returns:
- true, if the Zone is active
-
setActive
void setActive(boolean flag)
Changes the state of the Zone. De-activating a Zone at runtime will result in an abrupt disconnection of all Users. Use only when strictly necessary.- Parameters:
flag- the state of the Zone
-
isHidden
boolean isHidden()
INTERNAL
-
setHidden
void setHidden(boolean flag)
INTERNAL
-
setId
void setId(int id)
A numeric ID used by the AdminTool. The true identifier of a Zone is its name- Parameters:
id- the id
-
getName
java.lang.String getName()
The name of the Zone. Each Zone must have a unique name.- Returns:
- the name of the Zone.
-
getId
int getId()
A numeric ID used by the AdminTool. The true identifier of a Zone is its name- Returns:
- the id
-
getMaxAllowedUsers
int getMaxAllowedUsers()
The maximum number of users allowed to join the Zone.- Returns:
- the maximum number of users allowed to join the Zone.
-
setMaxAllowedUsers
void setMaxAllowedUsers(int max)
Set the maximum number of users allowed to join the Zone.- Parameters:
max- the max allowed Users
-
getMaxAllowedRooms
int getMaxAllowedRooms()
The maximum number of Rooms that can be created in the Room.- Returns:
- the maximum number of Rooms that can be created in the Room.
-
setMaxAllowedRooms
void setMaxAllowedRooms(int max)
Set the maximum number of Rooms that can be created in the Room.- Parameters:
max- the maximum number of Rooms that can be created in the Room.
-
getMaxRoomsCreatedPerUserLimit
int getMaxRoomsCreatedPerUserLimit()
The maximum number of Rooms that a User can create at once.Example: if the limit is == 3 and the User has created Rooms A, B and C he won't be able to create any more Room at least until any of these Rooms is destroyed.
- Returns:
- the maximum number of Rooms that a User can create at once.
-
setMaxRoomsCreatedPerUserLimit
void setMaxRoomsCreatedPerUserLimit(int max)
Set the maximum number of Rooms that a User can create at once.- Parameters:
max- the maximum number of Rooms that a User can create at once.
-
getMaxUserVariablesAllowed
int getMaxUserVariablesAllowed()
The maximum number of User Variables allowed for each User.- Returns:
- the maximum number of User Variables allowed for each User.
-
setMaxUserVariablesAllowed
void setMaxUserVariablesAllowed(int max)
Set the maximum number of User Variables allowed for each User.- Parameters:
max- the maximum number of User Variables allowed for each User.
-
getMaxRoomVariablesAllowed
int getMaxRoomVariablesAllowed()
The maximum number of Room Variables allowed for each Room.NOTE: each Room can set its own limit of Room Variables. However when a Room is created from a client request this Zone limit is applied.
- Returns:
- the maximum number of Room Variables allowed for each Room.
-
setMaxRoomVariablesAllowed
void setMaxRoomVariablesAllowed(int max)
Set the maximum number of Room variables allowed in the Room- Parameters:
max- the maximum number of Room variables allowed in the RoomNOTE: each Room can set its own limit of Room Variables. However when a Room is created from a client request this Zone limit is applied.
-
getMinRoomNameChars
int getMinRoomNameChars()
The minimum number of characters allowed for Room name- Returns:
- the minimum number of characters allowed for Room name
-
setMinRoomNameChars
void setMinRoomNameChars(int min)
Set the minimum number of characters allowed for a Room name- Parameters:
min- the minimum number of characters allowed for Room name
-
getMaxRoomNameChars
int getMaxRoomNameChars()
The maximum number of characters allowed for a Room name- Returns:
- the maximum number of characters allowed for a Room name
-
setMaxRoomNameChars
void setMaxRoomNameChars(int max)
Set the maximum number of characters allowed for a Room name- Parameters:
max- the maximum number of characters allowed for a Room name
-
getUserCountChangeUpdateInterval
int getUserCountChangeUpdateInterval()
Get the rate (in ms.) at which the UserCountUpdates events are fired to the clients.A value of zero will use the default, real-time updating that was also present in SmartFoxServer 1.x In high traffic servers these updates could be thousands per second, so we highly recommend to use a slower update rate in order to optimize the network usage. Reasonable values can be in the range of 500ms - 2000ms
- Returns:
- the interval in milliseconds between each UserCountUpdate
-
setUserCountChangeUpdateInterval
void setUserCountChangeUpdateInterval(int interval)
Set the rate (in ms.) at which the UserCountUpdates events are fired to the clients.- Parameters:
interval- the interval in ms between each UserCountUpdate. Recommended range: 500-2000ms.
-
getMaxUserIdleTime
int getMaxUserIdleTime()
Get the max allowed idle time for a User. When this interval expires the server will disconnect the "idle" User. Any request sent from the client will reset the Idle timer.- Returns:
- the time in seconds
-
setMaxUserIdleTime
void setMaxUserIdleTime(int seconds)
Set the max allowed idle time for a User. When this interval expires the server will disconnect the "idle" User. Any request sent from the client will reset the Idle timer.- Parameters:
seconds- the interval
-
isCustomLogin
boolean isCustomLogin()
Check if the Zone fires LOGIN events to the Zone extension at login time. This allows the developer to take full control over the login process in their extension code, like checking the credentials etc...- Returns:
- true if the Zone uses a custom login process
- See Also:
SFSEvent,SFSEventType
-
isForceLogout
boolean isForceLogout()
If turned on it allows a User to connect from another location while another connection is already active. This will result in the first session to be disconnected and the new one to be started.- Returns:
- true if the feature is turned on
-
setForceLogout
void setForceLogout(boolean flag)
If turned on it allows a User to connect from another location while another connection is already active. This will result in the first session to be disconnected and the new one to be started.- Parameters:
flag-
-
setCustomLogin
void setCustomLogin(boolean flag)
Set the Zone as Custom login. If turned on the developer's Extension will be able to take control over the login process.- Parameters:
flag-- See Also:
SFSEvent,SFSEventType
-
isGuestUserAllowed
boolean isGuestUserAllowed()
Check if the Zone allows guest users (those sending no name and no password). If so the server will automatically set up a "guest name" for the User.- Returns:
- true if the Zone allows guests
- See Also:
getGuestUserNamePrefix()
-
setGuestUserAllowed
void setGuestUserAllowed(boolean flag)
Toggles the Zone guest users (login with no name and no password). If active the server will automatically set up a "guest name" for the User.- Parameters:
flag-- See Also:
getGuestUserNamePrefix()
-
isFilterUserNames
boolean isFilterUserNames()
If turned on the Zone will apply the Words Filter to User names provided at login time- Returns:
- true if filtering is turned on
-
setFilterUserNames
void setFilterUserNames(boolean flag)
Toggle the filtering of User names via the Words Filter at login time.- Parameters:
flag-
-
isFilterRoomNames
boolean isFilterRoomNames()
If turned on the Zone will apply the Words Filter to Room names- Returns:
- true if filtering is turned on
-
setFilterRoomNames
void setFilterRoomNames(boolean flag)
Toggle the filtering of Room names via the Words Filter.- Parameters:
flag- a boolean
-
isFilterPrivateMessages
boolean isFilterPrivateMessages()
If turned on the Zone will apply the Words Filter to private messages- Returns:
- true if the Words Filter is applied to private messages
-
setFilterPrivateMessages
void setFilterPrivateMessages(boolean flag)
Toggle the filtering of private messages via the Words Filter.- Parameters:
flag-
-
isFilterBuddyMessages
boolean isFilterBuddyMessages()
Toggle the filtering of Buddy messages via the Words Filter.- Returns:
- true if buddy messages filtering is turned on
-
setFilterBuddyMessages
void setFilterBuddyMessages(boolean flag)
If turned on the Zone will apply the Words Filter to Buddy messages- Parameters:
flag-
-
getUserReconnectionSeconds
int getUserReconnectionSeconds()
Return the amount of seconds available for a User to reconnect to the system in case their socket connection goes down. A value of zero will turn the reconnection feature off.- Returns:
- the amount of seconds to reconnect.
-
setUserReconnectionSeconds
void setUserReconnectionSeconds(int seconds)
Set the amount of seconds available for a User to reconnect to the system in case their socket connection goes down. A value of zero will turn the reconnection feature off.- Parameters:
seconds- the amount of seconds to reconnect
-
getGuestUserNamePrefix
java.lang.String getGuestUserNamePrefix()
Get the prefix used by the system to auto-generate guest user names.Example: by default the prefix is "Guest#"
At the end of the prefix it will be added the unique user id.- Returns:
- the user name prefix
-
setGuestUserNamePrefix
void setGuestUserNamePrefix(java.lang.String prefix)
Set the prefix used by the system to auto-generate guest user names.Example: by default the prefix is "Guest#"
At the end of the prefix it will be added the unique user id.- Parameters:
prefix-
-
getDefaultPlayerIdGeneratorClassName
java.lang.String getDefaultPlayerIdGeneratorClassName()
-
setDefaultPlayerIdGeneratorClassName
void setDefaultPlayerIdGeneratorClassName(java.lang.String className)
-
isUploadEnabled
boolean isUploadEnabled()
True if the Zone supports HTTP uploads.- Returns:
- true if the Zone supports HTTP uploads.
-
setUploadEnabled
void setUploadEnabled(boolean val)
Switches on/off the ability to upload data via HTTP. This in turn causes theSFSEventType.FILE_UPLOADevent to be fired at Zone Level.
-
isGeoLocationEnabled
boolean isGeoLocationEnabled()
Toggles geolocation for clients.- Returns:
- true if geolocation is enabled in this Zone
- Since:
- 2.12
-
setGeoLocationEnabled
void setGeoLocationEnabled(boolean value)
Toggles geolocation for clients.NOTE:IP address geolocation is done via a local database so the added performance cost is negligible.
- Parameters:
value- true to enable the geolocation service, false to turn it off. Default = false
-
getPublicGroups
java.util.List<java.lang.String> getPublicGroups()
Get a list of names of the "Public" Room Groups available in the Zone. Public Groups are those in which the client is allowed to create Rooms dynamically. The other Groups can be manipulated only via server side code.- Returns:
- the list of group ids
-
setPublicGroups
void setPublicGroups(java.util.List<java.lang.String> groupIDs)
-
getGroups
java.util.List<java.lang.String> getGroups()
Get the full list of Room Groups available in the Zone. More groups can be added from server side by simply assigning a non-existent Group Id to a newly created Room. As soon as the new Group is detected, it will be added to the Group List- Returns:
- the list of Room Groups
-
getDefaultGroups
java.util.List<java.lang.String> getDefaultGroups()
Get the list of Groups that each User will be automatically subscribed to when joining the Zone.- Returns:
- the list of default groups
- See Also:
SFSApi.subscribeRoomGroup(User, String)
-
setDefaultGroups
void setDefaultGroups(java.util.List<java.lang.String> groupIDs)
-
getPrivilegeManager
PrivilegeManager getPrivilegeManager()
-
setPrivilegeManager
void setPrivilegeManager(PrivilegeManager privilegeManager)
-
getUserCount
int getUserCount()
Get the current amount of Users connected to the Zone- Returns:
- the amount of Users connected to the Zone
-
getTotalRoomCount
int getTotalRoomCount()
-
getGameRoomCount
int getGameRoomCount()
-
createRoom
Room createRoom(CreateRoomSettings params) throws SFSCreateRoomException
- Throws:
SFSCreateRoomException
-
createRoom
Room createRoom(CreateRoomSettings params, User user) throws SFSCreateRoomException
- Throws:
SFSCreateRoomException
-
isClientAllowedToOverridRoomEvents
boolean isClientAllowedToOverridRoomEvents()
-
setClientAllowedToOverridRoomEvents
void setClientAllowedToOverridRoomEvents(boolean flag)
-
registerEventsForRoomGroup
void registerEventsForRoomGroup(java.lang.String groupId, java.util.Set<SFSRoomEvents> flags)
-
isGroupEventSet
boolean isGroupEventSet(java.lang.String groupId, SFSRoomEvents eventToCheck)Checks whether a specific Room Event for the specified Group is active- Parameters:
groupId- the group nameeventToCheck- the type of event to check- Returns:
- true if the event is active
-
getGroupEvents
java.util.Set<SFSRoomEvents> getGroupEvents(java.lang.String groupId)
-
getRoomManager
com.smartfoxserver.v2.entities.managers.IRoomManager getRoomManager()
Obtain a reference to the internal Room Manager- Returns:
- the Room Manager
- Since:
- 2.12
-
containsGroup
boolean containsGroup(java.lang.String groupId)
Check if the Zone contains the specified Group- Returns:
- true if the Zone contains the specified Group
-
containsPublicGroup
boolean containsPublicGroup(java.lang.String groupId)
Check if the Zone contains the specified public Group- Returns:
- true if the Zone contains the specified public Group
-
getProperty
java.lang.Object getProperty(java.lang.Object key)
Properties are custom values that can be added or removed from the Zone at run-time. They can be used for many purposes, in particular to keep global references that can be shared across multiple objects in the extension code, Rooms etc...- Parameters:
key- the name of the property- Returns:
- the value of the property, null if the property doesn't exist
-
setProperty
void setProperty(java.lang.Object key, java.lang.Object value)Properties are custom values that can be added or removed from the Zone at run-time. They can be used for many purposes, in particular to keep global references that can be shared across multiple objects in the extension code, Rooms etc...- Parameters:
key- the name of the propertyvalue- the value of the property
-
containsProperty
boolean containsProperty(java.lang.Object key)
Checks the existance of a Zone property- Parameters:
key- the name of the property- Returns:
- true if the property exists
-
removeProperty
void removeProperty(java.lang.Object key)
Remove a property.- Parameters:
key- the name of the property.- See Also:
setProperty(Object, Object)
-
getZoneManager
com.smartfoxserver.v2.entities.managers.IZoneManager getZoneManager()
-
setZoneManager
void setZoneManager(com.smartfoxserver.v2.entities.managers.IZoneManager manager)
-
getRoomList
java.util.List<Room> getRoomList()
Get the list of Rooms in the Zone- Returns:
- the room list
-
getRoomListFromGroup
java.util.List<Room> getRoomListFromGroup(java.lang.String groupId)
Get the list of Rooms from a specific Group- Parameters:
groupId- the id of the group- Returns:
- the list of Rooms in the specified Group
-
getRoomListFromGroupList
java.util.List<Room> getRoomListFromGroupList(java.util.Collection<java.lang.String> groups)
Obtain a Room list generated by merging all Rooms from the provided group names- Parameters:
groups- a list of valid Room Group names- Returns:
- the Room list generated by merging all Rooms from the provided group names
-
getRoomById
Room getRoomById(int id)
Get a Room from its unique ID- Parameters:
id- the Room id- Returns:
- the Room or null if no Room exists with the specified ID
-
getRoomByName
Room getRoomByName(java.lang.String name)
Get a Room from its name- Parameters:
name- the Room name- Returns:
- the Room or null if no Room exists with the specified name
-
addRoom
void addRoom(Room room) throws SFSTooManyRoomsException
INTERNALInstead use
SFSApi.createRoom(Zone, CreateRoomSettings, User)- Throws:
SFSTooManyRoomsException
-
removeRoom
void removeRoom(Room room)
INTERNALInstead use
SFSApi.removeRoom(Room)
-
removeRoom
void removeRoom(int roomId)
INTERNALInstead use
SFSApi.removeRoom(Room)
-
removeRoom
void removeRoom(java.lang.String name)
INTERNALInstead use
SFSApi.removeRoom(Room)
-
checkAndRemove
void checkAndRemove(Room room)
-
changeRoomName
void changeRoomName(Room room, java.lang.String newName) throws SFSRoomException
INTERNALInstead use
SFSApi.changeRoomName(User, Room, String)- Throws:
SFSRoomException
-
changeRoomPasswordState
void changeRoomPasswordState(Room room, java.lang.String password)
INTERNALInstead use
SFSApi.changeRoomPassword(User, Room, String)
-
changeRoomCapacity
void changeRoomCapacity(Room room, int newMaxUsers, int maxMaxSpect)
INTERNALInstead use
SFSApi.changeRoomCapacity(User, Room, int, int)
-
validateUserName
void validateUserName(java.lang.String name) throws SFSException- Throws:
SFSException
-
getUserById
User getUserById(int id)
Get a User from its unique ID- Parameters:
id- the User ID- Returns:
- the User, or null if no User exists with the provided ID
-
getUserByName
User getUserByName(java.lang.String name)
Get a User from its name- Parameters:
name- the User name- Returns:
- the User, or null if no User exists with the provided name
-
getUserBySession
User getUserBySession(ISession session)
Get a User from its Session object- Parameters:
session- the Session- Returns:
- the User, or null if no User exists for the provided Session. In this case it would mean that the client is connected but not logged id.
-
getUsersInGroup
java.util.Collection<User> getUsersInGroup(java.lang.String groupId)
Get a list of Users from all Rooms in the provided Room Group- Parameters:
groupId- a group Id- Returns:
- the list of Users from all Rooms in the provided Room Group
-
getSessionsInGroup
java.util.Collection<ISession> getSessionsInGroup(java.lang.String groupId)
Get a list of Sessions from all Rooms in the provided Room Group- Parameters:
groupId- a group Id- Returns:
- the list of Sessions from all Rooms in the provided Room Group
-
getSessionsListeningToGroup
java.util.Collection<ISession> getSessionsListeningToGroup(java.lang.String groupId)
Get a list of Sessions listening for events in a specific Group- Parameters:
groupId- a group Id- Returns:
- the list of Sessions listening for events in a specific Group
-
getSessionList
java.util.Collection<ISession> getSessionList()
Get the list of Sessions logged in the Zone- Returns:
- the list of Sessions logged in the Zone
-
getUserList
java.util.Collection<User> getUserList()
Get the list of Users logged in the Zone- Returns:
- the list of Users logged in the Zone
-
removeAllUsers
void removeAllUsers()
-
getFilterChain
ISystemFilterChain getFilterChain(SystemRequest requestId)
Obtain a reference to the Zone's SystemFilterChain. Here you can add custom filters that will execute before any System Request is handled by the system itself.- Parameters:
requestId- the request id associated with the filter chain- Returns:
- the SystemFilterChain
- Since:
- version 2.3.0
- See Also:
ISystemFilterChain,ISystemFilter
-
setFilterChain
void setFilterChain(SystemRequest requestId, ISystemFilterChain chain)
Set a SystemFilterChain for a specific SystemController's Request. For example you can set one ore more filters for the CreateRoom request or the PublicMessage etc... The filter chain will be executed before the request is passed to the SystemController.- Parameters:
requestId- the SystemController request Idchain- the filter chain- Since:
- version 2.3.0
- See Also:
SysControllerFilterChain,SysControllerFilter
-
isFilterChainInited
boolean isFilterChainInited()
Returns true if the FilterChain was initialized- Returns:
- true if at least one Filter was added to the FilterChain
- Since:
- version 2.3.0
-
resetSystemFilterChain
void resetSystemFilterChain()
Resets the whole SystemController Filter chain. All filters for any SystemRequest is removed.
-
removeUser
void removeUser(int userId)
INTERNALInstead use
SFSApi.disconnectUser(User)
-
removeUser
void removeUser(java.lang.String userName)
INTERNALInstead use
SFSApi.disconnectUser(User)
-
removeUser
void removeUser(ISession session)
INTERNALInstead use
SFSApi.disconnect(ISession)
-
removeUser
void removeUser(User user)
INTERNALInstead use
SFSApi.disconnectUser(User)
-
removeUserFromRoom
void removeUserFromRoom(User user, Room room)
INTERNALInstead use
SFSApi.leaveRoom(User, Room)
-
getUCountThrottler
com.smartfoxserver.v2.util.IResponseThrottler getUCountThrottler()
INTERNAL
-
getWordFilter
IWordFilter getWordFilter()
INTERNAL
-
getFloodFilter
IFloodFilter getFloodFilter()
INTERNAL
-
getExtension
ISFSExtension getExtension()
INTERNAL
-
setExtension
void setExtension(ISFSExtension extension)
INTERNAL
-
getDBManager
IDBManager getDBManager()
Obtain a reference to the Zone's Database Manager.- See Also:
SFSDBManager
-
setDBManager
void setDBManager(IDBManager manager)
INTERNAL
-
initRoomPersistence
void initRoomPersistence(RoomStorageMode mode, BaseStorageConfig config)
Initializes the Room Persistence functionality. Typically you will invoke this method in the init() method of your Extension.The Room Persistence API provides two different storage systems for Rooms:
- FILE_STORAGE: which uses the local file system to store Room data. Doesn't require a config object.
- DB_STORAGE which uses an external database (via the Zone's DBManager) to store Room data. Requires a config object.
- Parameters:
config- an optional config object. At the moment it is required only for DB_STORAGE mode only.- Since:
- 2.8.0
- See Also:
RoomStorageMode,SFSDBManager,IRoomStorage
-
getRoomPersistenceApi
IRoomStorage getRoomPersistenceApi()
Obtain the Room Persistence API object.IMPORTANT: it is necessary to first initialize the Persistence system before accessing it. Failing this will return a null object.
- Returns:
- the Room Persistence API object or null if the API was not initialized.
- Since:
- 2.8.0
- See Also:
initRoomPersistence(RoomStorageMode, BaseStorageConfig),IRoomStorage
-
addDisabledSystemEvent
void addDisabledSystemEvent(java.lang.String eventID)
INTERNAL
-
removeDisabledSystemEvent
void removeDisabledSystemEvent(java.lang.String eventID)
INTERNAL
-
isSystemEventAllowed
boolean isSystemEventAllowed(java.lang.String eventID)
INTERNAL
-
login
User login(LoginData loginData) throws SFSLoginException
INTERNALInstead use
SFSApi.login(ISession, String, String, String, com.smartfoxserver.v2.entities.data.ISFSObject)- Throws:
SFSLoginException
-
getRoomListData
ISFSArray getRoomListData()
INTERNAL
-
getRoomListData
ISFSArray getRoomListData(java.util.List<java.lang.String> groupIds)
INTERNAL
-
getBuddyListManager
BuddyListManager getBuddyListManager()
INTERNALInstead use
SFSBuddyApi
-
setBuddyListManager
void setBuddyListManager(BuddyListManager buddyListManager)
INTERNAL
-
isEncrypted
boolean isEncrypted()
True if protocol cryptography is turned on in this Zone. Requests sent unencrypted when the flag is turned ON will result in a sudden client disconnection.- Returns:
- returns true if protocol cryptography is turned on in this Zone
- Since:
- 2.10
-
setEncrypted
void setEncrypted(boolean value)
Toggles the protocol cryptography.- Parameters:
value- toggles protocol cryptography.- Since:
- 2.10
-
getMaxInvitationsPerRequest
int getMaxInvitationsPerRequest()
Get the max number of people that can be invited a by a single client side JoinRoomInvitationRequest- Returns:
- the max number of people that can be invited a by a single client side JoinRoomInvitationRequest
- Since:
- 2.12
-
setMaxInvitationsPerRequest
void setMaxInvitationsPerRequest(int maxInvitationsPerRequest)
Set the max number of people that can be invited a by a single client side JoinRoomInvitationRequest- Parameters:
maxInvitationsPerRequest- the max number of people that can be invited in each request- Since:
- 2.12
-
isAllowInvitationsOnlyForBuddies
boolean isAllowInvitationsOnlyForBuddies()
True if only buddies can be invited by a client side JoinRoomInvitationRequest, false otherwise.- Returns:
- True if only buddies can be invited by a client side JoinRoomInvitationRequest, false otherwise.
- Since:
- 2.12
-
setAllowInvitationsOnlyForBuddies
void setAllowInvitationsOnlyForBuddies(boolean allowInvitationsOnlyForBuddies)
Set to true if only buddies can be invited by a client side JoinRoomInvitationRequest, false otherwise.- Parameters:
allowInvitationsOnlyForBuddies-- Since:
- 2.12
-
getMaxFailedLogins
int getMaxFailedLogins()
The max number of login attempts (in the same session) a user can fail before being disconnected.- Returns:
- the max number of login attempts (in the same session) a user can fail before being disconnected.
- Since:
- 2.12
-
setMaxFailedLogins
void setMaxFailedLogins(int value)
Set the max number of login attempts (in the same session) a user can fail before being disconnected.- Parameters:
value- the max number of login attempts (in the same session) a user can fail before being disconnected.- Since:
- 2.12
-
getMaxFindUserResults
int getMaxFindUserResults()
Get the max number of "Find User" results for a client request. Default is 50.- Parameters:
the- max number of results for "Find User" requests from client side.- Since:
- 2.14
-
setMaxFindUserResults
void setMaxFindUserResults(int value)
Set the max number of "FindUser" results for a client request. Default is 50.- Parameters:
the- max number of results for "FindUser" requests from client side.- Since:
- 2.14
-
getMaxFindRoomResults
int getMaxFindRoomResults()
Get the max number of "FindRoom" results for a client request. Default is 50.- Parameters:
the- max number of results for "FindRoom" requests from client side.- Since:
- 2.14
-
setMaxFindRoomResults
void setMaxFindRoomResults(int value)
Set the max number of "FindRoom" results for a client request. Default is 50.- Parameters:
the- max number of results for "FindRoom" requests from client side.- Since:
- 2.14
-
isLagMonitorKeepAlive
boolean isLagMonitorKeepAlive()
Returns true if the LagMonitor requests are also actively resetting the User's idle timer- Since:
- 2.18.2
-
setLagMonitorKeepAlive
void setLagMonitorKeepAlive(boolean value)
Resets the the Users' idle timer for every client side LagMonitor request, when set to true;- Parameters:
value- whether or not the LagMonitor requests should reset the User's idle timer
-
getDump
java.lang.String getDump()
-
-