Class SFSZone

  • All Implemented Interfaces:
    Zone

    public final class SFSZone
    extends java.lang.Object
    implements Zone

    Overview

    The Zone represent an application running in the Server, from a simple chat application to a large scale MMO with dozens of games. Each Zone can contain any number of Rooms organized in Room Groups.

    Also each Zone provides a number of essential services:

    • Room and User management
    • Persistent BuddyList system
    • Words filtering
    • Flood filtering
    • Database connection management and pooling
    • Event dispatching
    • Room persistence
    Finally each Zone is fully extensible via the use of a server side Extension which allow to process client requests, server events and more. The Extension is attached to the Zone itself and initialized as soon as the Zone is ready. The Extension can take control of the Zone and interact with the server via the server side API.
    See Also:
    Room, SFSApi, BaseSFSExtension, SFSExtension
    • Field Detail

      • lagMonitorKeepAlive

        public volatile boolean lagMonitorKeepAlive
    • Constructor Detail

      • SFSZone

        public SFSZone​(java.lang.String name)
    • Method Detail

      • getRoomManager

        public com.smartfoxserver.v2.entities.managers.IRoomManager getRoomManager()
        Obtain a reference to the internal Room Manager
        Specified by:
        getRoomManager in interface Zone
        Returns:
        the Room Manager
      • getUserManager

        public com.smartfoxserver.v2.entities.managers.IUserManager getUserManager()
        Specified by:
        getUserManager in interface Zone
      • containsGroup

        public boolean containsGroup​(java.lang.String groupId)
        Check if the Zone contains the specified Group
        Specified by:
        containsGroup in interface Zone
        Returns:
        true if the Zone contains the specified Group
      • containsPublicGroup

        public boolean containsPublicGroup​(java.lang.String groupId)
        Check if the Zone contains the specified public Group
        Specified by:
        containsPublicGroup in interface Zone
        Returns:
        true if the Zone contains the specified public Group
      • addDisabledSystemEvent

        public void addDisabledSystemEvent​(java.lang.String eventID)
        Description copied from interface: Zone
        INTERNAL
        Specified by:
        addDisabledSystemEvent in interface Zone
      • getGuestUserNamePrefix

        public 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.

        Specified by:
        getGuestUserNamePrefix in interface Zone
        Returns:
        the user name prefix
      • getUserCount

        public int getUserCount()
        Get the current amount of Users connected to the Zone
        Specified by:
        getUserCount in interface Zone
        Returns:
        the amount of Users connected to the Zone
      • getGameRoomCount

        public int getGameRoomCount()
        Specified by:
        getGameRoomCount in interface Zone
      • getMaxAllowedRooms

        public int getMaxAllowedRooms()
        The maximum number of Rooms that can be created in the Room.
        Specified by:
        getMaxAllowedRooms in interface Zone
        Returns:
        the maximum number of Rooms that can be created in the Room.
      • getMaxUserVariablesAllowed

        public int getMaxUserVariablesAllowed()
        The maximum number of User Variables allowed for each User.
        Specified by:
        getMaxUserVariablesAllowed in interface Zone
        Returns:
        the maximum number of User Variables allowed for each User.
      • getMaxAllowedUsers

        public int getMaxAllowedUsers()
        The maximum number of users allowed to join the Zone.
        Specified by:
        getMaxAllowedUsers in interface Zone
        Returns:
        the maximum number of users allowed to join the Zone.
      • getMaxRoomsCreatedPerUserLimit

        public 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.

        Specified by:
        getMaxRoomsCreatedPerUserLimit in interface Zone
        Returns:
        the maximum number of Rooms that a User can create at once.
      • getName

        public java.lang.String getName()
        The name of the Zone. Each Zone must have a unique name.
        Specified by:
        getName in interface Zone
        Returns:
        the name of the Zone.
      • getId

        public int getId()
        A numeric ID used by the AdminTool. The true identifier of a Zone is its name
        Specified by:
        getId in interface Zone
        Returns:
        the id
      • getProperty

        public 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...
        Specified by:
        getProperty in interface Zone
        Parameters:
        key - the name of the property
        Returns:
        the value of the property, null if the property doesn't exist
      • getPublicGroups

        public 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.
        Specified by:
        getPublicGroups in interface Zone
        Returns:
        the list of group ids
      • getGroups

        public 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
        Specified by:
        getGroups in interface Zone
        Returns:
        the list of Room Groups
      • getDefaultGroups

        public java.util.List<java.lang.String> getDefaultGroups()
        Get the list of Groups that each User will be automatically subscribed to when joining the Zone.
        Specified by:
        getDefaultGroups in interface Zone
        Returns:
        the list of default groups
        See Also:
        SFSApi.subscribeRoomGroup(User, String)
      • getRoomById

        public Room getRoomById​(int id)
        Get a Room from its unique ID
        Specified by:
        getRoomById in interface Zone
        Parameters:
        id - the Room id
        Returns:
        the Room or null if no Room exists with the specified ID
      • getRoomByName

        public Room getRoomByName​(java.lang.String name)
        Get a Room from its name
        Specified by:
        getRoomByName in interface Zone
        Parameters:
        name - the Room name
        Returns:
        the Room or null if no Room exists with the specified name
      • getRoomList

        public java.util.List<Room> getRoomList()
        Get the list of Rooms in the Zone
        Specified by:
        getRoomList in interface Zone
        Returns:
        the room list
      • getRoomListFromGroup

        public java.util.List<Room> getRoomListFromGroup​(java.lang.String groupId)
        Get the list of Rooms from a specific Group
        Specified by:
        getRoomListFromGroup in interface Zone
        Parameters:
        groupId - the id of the group
        Returns:
        the list of Rooms in the specified Group
      • getRoomListFromGroupList

        public java.util.List<Room> getRoomListFromGroupList​(java.util.Collection<java.lang.String> groups)
        Description copied from interface: Zone
        Obtain a Room list generated by merging all Rooms from the provided group names
        Specified by:
        getRoomListFromGroupList in interface Zone
        Parameters:
        groups - a list of valid Room Group names
        Returns:
        the Room list generated by merging all Rooms from the provided group names
      • getUserById

        public User getUserById​(int id)
        Get a User from its unique ID
        Specified by:
        getUserById in interface Zone
        Parameters:
        id - the User ID
        Returns:
        the User, or null if no User exists with the provided ID
      • getUserByName

        public User getUserByName​(java.lang.String name)
        Get a User from its name
        Specified by:
        getUserByName in interface Zone
        Parameters:
        name - the User name
        Returns:
        the User, or null if no User exists with the provided name
      • getUserBySession

        public User getUserBySession​(ISession session)
        Get a User from its Session object
        Specified by:
        getUserBySession in interface Zone
        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.
      • getUserCountChangeUpdateInterval

        public 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

        Specified by:
        getUserCountChangeUpdateInterval in interface Zone
        Returns:
        the interval in milliseconds between each UserCountUpdate
      • getUCountThrottler

        public com.smartfoxserver.v2.util.IResponseThrottler getUCountThrottler()
        Description copied from interface: Zone
        INTERNAL
        Specified by:
        getUCountThrottler in interface Zone
      • isUploadEnabled

        public boolean isUploadEnabled()
        True if the Zone supports HTTP uploads.
        Specified by:
        isUploadEnabled in interface Zone
        Returns:
        true if the Zone supports HTTP uploads.
      • setUploadEnabled

        public void setUploadEnabled​(boolean val)
        Switches on/off the ability to upload data via HTTP. This in turn causes the SFSEventType.FILE_UPLOAD event to be fired at Zone Level.
        Specified by:
        setUploadEnabled in interface Zone
      • isLagMonitorKeepAlive

        public boolean isLagMonitorKeepAlive()
        Description copied from interface: Zone
        Returns true if the LagMonitor requests are also actively resetting the User's idle timer
        Specified by:
        isLagMonitorKeepAlive in interface Zone
      • setLagMonitorKeepAlive

        public void setLagMonitorKeepAlive​(boolean value)
        Description copied from interface: Zone
        Resets the the Users' idle timer for every client side LagMonitor request, when set to true;
        Specified by:
        setLagMonitorKeepAlive in interface Zone
        Parameters:
        value - whether or not the LagMonitor requests should reset the User's idle timer
      • isFilterChainInited

        public boolean isFilterChainInited()
        Returns true if the FilterChain was initialized
        Specified by:
        isFilterChainInited in interface Zone
        Returns:
        true if at least one Filter was added to the FilterChain
      • resetSystemFilterChain

        public void resetSystemFilterChain()
        Resets the whole SystemController Filter chain. All filters for any SystemRequest is removed.
        Specified by:
        resetSystemFilterChain in interface Zone
      • isHidden

        public boolean isHidden()
        Description copied from interface: Zone
        INTERNAL
        Specified by:
        isHidden in interface Zone
      • setHidden

        public void setHidden​(boolean flag)
        Description copied from interface: Zone
        INTERNAL
        Specified by:
        setHidden in interface Zone
      • getFilterChain

        public 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.
        Specified by:
        getFilterChain in interface Zone
        Parameters:
        requestId - the request id associated with the filter chain
        Returns:
        the SystemFilterChain
        See Also:
        ISystemFilterChain, ISystemFilter
      • setFilterChain

        public 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.
        Specified by:
        setFilterChain in interface Zone
        Parameters:
        requestId - the SystemController request Id
        chain - the filter chain
        See Also:
        SysControllerFilterChain, SysControllerFilter
      • setExtension

        public void setExtension​(ISFSExtension extension)
        Description copied from interface: Zone
        INTERNAL
        Specified by:
        setExtension in interface Zone
      • getUserReconnectionSeconds

        public 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.
        Specified by:
        getUserReconnectionSeconds in interface Zone
        Returns:
        the amount of seconds to reconnect.
      • setUserReconnectionSeconds

        public 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.
        Specified by:
        setUserReconnectionSeconds in interface Zone
        Parameters:
        seconds - the amount of seconds to reconnect
      • getMaxUserIdleTime

        public 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.
        Specified by:
        getMaxUserIdleTime in interface Zone
        Returns:
        the time in seconds
      • setMaxUserIdleTime

        public 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.
        Specified by:
        setMaxUserIdleTime in interface Zone
        Parameters:
        seconds - the interval
      • getUsersInGroup

        public java.util.Collection<User> getUsersInGroup​(java.lang.String groupId)
        Get a list of Users from all Rooms in the provided Room Group
        Specified by:
        getUsersInGroup in interface Zone
        Parameters:
        groupId - a group Id
        Returns:
        the list of Users from all Rooms in the provided Room Group
      • getSessionsInGroup

        public java.util.Collection<ISession> getSessionsInGroup​(java.lang.String groupId)
        Get a list of Sessions from all Rooms in the provided Room Group
        Specified by:
        getSessionsInGroup in interface Zone
        Parameters:
        groupId - a group Id
        Returns:
        the list of Sessions from all Rooms in the provided Room Group
      • getSessionsListeningToGroup

        public java.util.Collection<ISession> getSessionsListeningToGroup​(java.lang.String groupId)
        Description copied from interface: Zone
        Get a list of Sessions listening for events in a specific Group
        Specified by:
        getSessionsListeningToGroup in interface Zone
        Parameters:
        groupId - a group Id
        Returns:
        the list of Sessions listening for events in a specific Group
      • getSessionList

        public java.util.Collection<ISession> getSessionList()
        Get the list of Sessions logged in the Zone
        Specified by:
        getSessionList in interface Zone
        Returns:
        the list of Sessions logged in the Zone
      • getUserList

        public java.util.Collection<User> getUserList()
        Get the list of Users logged in the Zone
        Specified by:
        getUserList in interface Zone
        Returns:
        the list of Users logged in the Zone
      • getZoneManager

        public com.smartfoxserver.v2.entities.managers.IZoneManager getZoneManager()
        Specified by:
        getZoneManager in interface Zone
      • isActive

        public 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.
        Specified by:
        isActive in interface Zone
        Returns:
        true, if the Zone is active
      • isCustomLogin

        public 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...
        Specified by:
        isCustomLogin in interface Zone
        Returns:
        true if the Zone uses a custom login process
        See Also:
        SFSEvent, SFSEventType
      • isForceLogout

        public 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.
        Specified by:
        isForceLogout in interface Zone
        Returns:
        true if the feature is turned on
      • isGuestUserAllowed

        public 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.
        Specified by:
        isGuestUserAllowed in interface Zone
        Returns:
        true if the Zone allows guests
        See Also:
        Zone.getGuestUserNamePrefix()
      • isSystemEventAllowed

        public boolean isSystemEventAllowed​(java.lang.String eventID)
        INTERNAL
        Specified by:
        isSystemEventAllowed in interface Zone
      • isFilterUserNames

        public boolean isFilterUserNames()
        If turned on the Zone will apply the Words Filter to User names provided at login time
        Specified by:
        isFilterUserNames in interface Zone
        Returns:
        true if filtering is turned on
      • isFilterRoomNames

        public boolean isFilterRoomNames()
        If turned on the Zone will apply the Words Filter to Room names
        Specified by:
        isFilterRoomNames in interface Zone
        Returns:
        true if filtering is turned on
      • setFilterRoomNames

        public void setFilterRoomNames​(boolean flag)
        Toggle the filtering of Room names via the Words Filter.
        Specified by:
        setFilterRoomNames in interface Zone
        Parameters:
        flag - a boolean
      • isFilterBuddyMessages

        public boolean isFilterBuddyMessages()
        Toggle the filtering of Buddy messages via the Words Filter.
        Specified by:
        isFilterBuddyMessages in interface Zone
        Returns:
        true if buddy messages filtering is turned on
      • setFilterBuddyMessages

        public void setFilterBuddyMessages​(boolean flag)
        If turned on the Zone will apply the Words Filter to Buddy messages
        Specified by:
        setFilterBuddyMessages in interface Zone
      • containsProperty

        public boolean containsProperty​(java.lang.Object key)
        Checks the existance of a Zone property
        Specified by:
        containsProperty in interface Zone
        Parameters:
        key - the name of the property
        Returns:
        true if the property exists
      • isGroupEventSet

        public boolean isGroupEventSet​(java.lang.String groupId,
                                       SFSRoomEvents eventToCheck)
        Checks whether a specific Room Event for the specified Group is active
        Specified by:
        isGroupEventSet in interface Zone
        Parameters:
        groupId - the group name
        eventToCheck - the type of event to check
        Returns:
        true if the event is active
      • removeDisabledSystemEvent

        public void removeDisabledSystemEvent​(java.lang.String eventID)
        Description copied from interface: Zone
        INTERNAL
        Specified by:
        removeDisabledSystemEvent in interface Zone
      • getMinRoomNameChars

        public int getMinRoomNameChars()
        The minimum number of characters allowed for Room name
        Specified by:
        getMinRoomNameChars in interface Zone
        Returns:
        the minimum number of characters allowed for Room name
      • setMinRoomNameChars

        public void setMinRoomNameChars​(int minRoomNameChars)
        Set the minimum number of characters allowed for a Room name
        Specified by:
        setMinRoomNameChars in interface Zone
        Parameters:
        minRoomNameChars - the minimum number of characters allowed for Room name
      • getMaxRoomNameChars

        public int getMaxRoomNameChars()
        The maximum number of characters allowed for a Room name
        Specified by:
        getMaxRoomNameChars in interface Zone
        Returns:
        the maximum number of characters allowed for a Room name
      • setMaxRoomNameChars

        public void setMaxRoomNameChars​(int maxRoomNameChars)
        Set the maximum number of characters allowed for a Room name
        Specified by:
        setMaxRoomNameChars in interface Zone
        Parameters:
        maxRoomNameChars - the maximum number of characters allowed for a Room name
      • setActive

        public 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.
        Specified by:
        setActive in interface Zone
        Parameters:
        flag - the state of the Zone
      • setId

        public void setId​(int id)
        Description copied from interface: Zone
        A numeric ID used by the AdminTool. The true identifier of a Zone is its name
        Specified by:
        setId in interface Zone
        Parameters:
        id - the id
      • setCustomLogin

        public void setCustomLogin​(boolean flag)
        Description copied from interface: Zone
        Set the Zone as Custom login. If turned on the developer's Extension will be able to take control over the login process.
        Specified by:
        setCustomLogin in interface Zone
        See Also:
        SFSEvent, SFSEventType
      • setForceLogout

        public void setForceLogout​(boolean flag)
        Description copied from interface: Zone
        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.
        Specified by:
        setForceLogout in interface Zone
      • setGuestUserAllowed

        public 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.
        Specified by:
        setGuestUserAllowed in interface Zone
        See Also:
        Zone.getGuestUserNamePrefix()
      • setFilterUserNames

        public void setFilterUserNames​(boolean flag)
        Toggle the filtering of User names via the Words Filter at login time.
        Specified by:
        setFilterUserNames in interface Zone
      • setGuestUserNamePrefix

        public 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.

        Specified by:
        setGuestUserNamePrefix in interface Zone
      • setMaxAllowedRooms

        public void setMaxAllowedRooms​(int max)
        Set the maximum number of Rooms that can be created in the Room.
        Specified by:
        setMaxAllowedRooms in interface Zone
        Parameters:
        max - the maximum number of Rooms that can be created in the Room.
      • setMaxAllowedUsers

        public void setMaxAllowedUsers​(int max)
        Set the maximum number of users allowed to join the Zone.
        Specified by:
        setMaxAllowedUsers in interface Zone
        Parameters:
        max - the max allowed Users
      • setMaxUserVariablesAllowed

        public void setMaxUserVariablesAllowed​(int max)
        Set the maximum number of User Variables allowed for each User.
        Specified by:
        setMaxUserVariablesAllowed in interface Zone
        Parameters:
        max - the maximum number of User Variables allowed for each User.
      • setMaxRoomsCreatedPerUserLimit

        public void setMaxRoomsCreatedPerUserLimit​(int max)
        Set the maximum number of Rooms that a User can create at once.
        Specified by:
        setMaxRoomsCreatedPerUserLimit in interface Zone
        Parameters:
        max - the maximum number of Rooms that a User can create at once.
      • setProperty

        public 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...
        Specified by:
        setProperty in interface Zone
        Parameters:
        key - the name of the property
        value - the value of the property
      • setPublicGroups

        public void setPublicGroups​(java.util.List<java.lang.String> groupIDs)
        Specified by:
        setPublicGroups in interface Zone
      • setDefaultGroups

        public void setDefaultGroups​(java.util.List<java.lang.String> groupIDs)
        Specified by:
        setDefaultGroups in interface Zone
      • setUserCountChangeUpdateInterval

        public void setUserCountChangeUpdateInterval​(int interval)
        Set the rate (in ms.) at which the UserCountUpdates events are fired to the clients.
        Specified by:
        setUserCountChangeUpdateInterval in interface Zone
        Parameters:
        interval - the interval in ms between each UserCountUpdate. Recommended range: 500-2000ms.
      • setZoneManager

        public void setZoneManager​(com.smartfoxserver.v2.entities.managers.IZoneManager manager)
        Specified by:
        setZoneManager in interface Zone
      • removeAllUsers

        public void removeAllUsers()
        Specified by:
        removeAllUsers in interface Zone
      • getMaxRoomVariablesAllowed

        public 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.

        Specified by:
        getMaxRoomVariablesAllowed in interface Zone
        Returns:
        the maximum number of Room Variables allowed for each Room.
      • setMaxRoomVariablesAllowed

        public void setMaxRoomVariablesAllowed​(int max)
        Set the maximum number of Room variables allowed in the Room
        Specified by:
        setMaxRoomVariablesAllowed in interface Zone
        Parameters:
        max - the maximum number of Room variables allowed in the 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.

      • setDBManager

        public void setDBManager​(IDBManager manager)
        Description copied from interface: Zone
        INTERNAL
        Specified by:
        setDBManager in interface Zone
      • isFilterPrivateMessages

        public boolean isFilterPrivateMessages()
        If turned on the Zone will apply the Words Filter to private messages
        Specified by:
        isFilterPrivateMessages in interface Zone
        Returns:
        true if the Words Filter is applied to private messages
      • setFilterPrivateMessages

        public void setFilterPrivateMessages​(boolean flag)
        Toggle the filtering of private messages via the Words Filter.
        Specified by:
        setFilterPrivateMessages in interface Zone
      • getRoomListData

        public ISFSArray getRoomListData​(java.util.List<java.lang.String> groupIds)
        Description copied from interface: Zone
        INTERNAL
        Specified by:
        getRoomListData in interface Zone
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getDump

        public java.lang.String getDump()
        Specified by:
        getDump in interface Zone
      • getAdminHelper

        public com.smartfoxserver.v2.util.IAdminHelper getAdminHelper()
      • setAdminHelper

        public void setAdminHelper​(com.smartfoxserver.v2.util.IAdminHelper adminHelper)
      • initRoomPersistence

        public 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.
        Specified by:
        initRoomPersistence in interface Zone
        config - an optional config object. At the moment it is required only for DB_STORAGE mode only.
        See Also:
        RoomStorageMode, SFSDBManager, IRoomStorage
      • isEncrypted

        public 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.
        Specified by:
        isEncrypted in interface Zone
        Returns:
        returns true if protocol cryptography is turned on in this Zone
      • setEncrypted

        public void setEncrypted​(boolean value)
        Toggles the protocol cryptography.
        Specified by:
        setEncrypted in interface Zone
        Parameters:
        value - toggles protocol cryptography.
      • getMaxInvitationsPerRequest

        public int getMaxInvitationsPerRequest()
        Get the max number of people that can be invited a by a single client side JoinRoomInvitationRequest
        Specified by:
        getMaxInvitationsPerRequest in interface Zone
        Returns:
        the max number of people that can be invited a by a single client side JoinRoomInvitationRequest
      • setMaxInvitationsPerRequest

        public void setMaxInvitationsPerRequest​(int maxInvitationsPerRequest)
        Set the max number of people that can be invited a by a single client side JoinRoomInvitationRequest
        Specified by:
        setMaxInvitationsPerRequest in interface Zone
        Parameters:
        maxInvitationsPerRequest - the max number of people that can be invited in each request
      • isAllowInvitationsOnlyForBuddies

        public boolean isAllowInvitationsOnlyForBuddies()
        True if only buddies can be invited by a client side JoinRoomInvitationRequest, false otherwise.
        Specified by:
        isAllowInvitationsOnlyForBuddies in interface Zone
        Returns:
        True if only buddies can be invited by a client side JoinRoomInvitationRequest, false otherwise.
      • setAllowInvitationsOnlyForBuddies

        public void setAllowInvitationsOnlyForBuddies​(boolean allowInvitationsOnlyForBuddies)
        Set to true if only buddies can be invited by a client side JoinRoomInvitationRequest, false otherwise.
        Specified by:
        setAllowInvitationsOnlyForBuddies in interface Zone
      • getMaxFailedLogins

        public int getMaxFailedLogins()
        Description copied from interface: Zone
        The max number of login attempts (in the same session) a user can fail before being disconnected.
        Specified by:
        getMaxFailedLogins in interface Zone
        Returns:
        the max number of login attempts (in the same session) a user can fail before being disconnected.
      • setMaxFailedLogins

        public void setMaxFailedLogins​(int value)
        Description copied from interface: Zone
        Set the max number of login attempts (in the same session) a user can fail before being disconnected.
        Specified by:
        setMaxFailedLogins in interface Zone
        Parameters:
        value - the max number of login attempts (in the same session) a user can fail before being disconnected.
      • isGeoLocationEnabled

        public boolean isGeoLocationEnabled()
        Description copied from interface: Zone
        Toggles geolocation for clients.
        Specified by:
        isGeoLocationEnabled in interface Zone
        Returns:
        true if geolocation is enabled in this Zone
      • setGeoLocationEnabled

        public void setGeoLocationEnabled​(boolean value)
        Description copied from interface: Zone
        Toggles geolocation for clients.

        NOTE:IP address geolocation is done via a local database so the added performance cost is negligible.

        Specified by:
        setGeoLocationEnabled in interface Zone
        Parameters:
        value - true to enable the geolocation service, false to turn it off. Default = false
      • getMaxFindUserResults

        public int getMaxFindUserResults()
        Description copied from interface: Zone
        Get the max number of "Find User" results for a client request. Default is 50.
        Specified by:
        getMaxFindUserResults in interface Zone
      • setMaxFindUserResults

        public void setMaxFindUserResults​(int value)
        Description copied from interface: Zone
        Set the max number of "FindUser" results for a client request. Default is 50.
        Specified by:
        setMaxFindUserResults in interface Zone
      • getMaxFindRoomResults

        public int getMaxFindRoomResults()
        Description copied from interface: Zone
        Get the max number of "FindRoom" results for a client request. Default is 50.
        Specified by:
        getMaxFindRoomResults in interface Zone
      • setMaxFindRoomResults

        public void setMaxFindRoomResults​(int value)
        Description copied from interface: Zone
        Set the max number of "FindRoom" results for a client request. Default is 50.
        Specified by:
        setMaxFindRoomResults in interface Zone