Class SFSZone

java.lang.Object
com.smartfoxserver.entities.SFSZone
All Implemented Interfaces:
Zone

public final class SFSZone extends 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:
  • Field Details

    • lagMonitorKeepAlive

      public volatile boolean lagMonitorKeepAlive
    • rdpTxConfig

      public com.smartfoxserver.bitswarm.rdp.TransportConfig rdpTxConfig
  • Constructor Details

    • SFSZone

      public SFSZone(String name)
  • Method Details

    • getRoomManager

      public com.smartfoxserver.entities.managers.IRoomManager getRoomManager()
      Specified by:
      getRoomManager in interface Zone
    • getUserManager

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

      public boolean containsGroup(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(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
    • createRoom

      public Room createRoom(CreateRoomSettings params, User user) throws SFSCreateRoomException
      Specified by:
      createRoom in interface Zone
      Throws:
      SFSCreateRoomException
    • createRoom

      public Room createRoom(CreateRoomSettings params) throws SFSCreateRoomException
      Specified by:
      createRoom in interface Zone
      Throws:
      SFSCreateRoomException
    • changeRoomName

      public void changeRoomName(Room room, String newName) throws SFSRoomException
      Specified by:
      changeRoomName in interface Zone
      Throws:
      SFSRoomException
    • changeRoomPasswordState

      public void changeRoomPasswordState(Room room, String password)
      Specified by:
      changeRoomPasswordState in interface Zone
    • changeRoomCapacity

      public void changeRoomCapacity(Room room, int newMaxUsers, int newMaxSpect)
      Specified by:
      changeRoomCapacity in interface Zone
    • addRoom

      public void addRoom(Room room) throws SFSTooManyRoomsException
      Specified by:
      addRoom in interface Zone
      Throws:
      SFSTooManyRoomsException
    • getGuestUserNamePrefix

      public 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
    • getTotalRoomCount

      public int getTotalRoomCount()
      Specified by:
      getTotalRoomCount in interface Zone
      Returns:
      the total number of Rooms
    • getGameRoomCount

      public int getGameRoomCount()
      Specified by:
      getGameRoomCount in interface Zone
      Returns:
      the total number of game Rooms
    • 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 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()
      Specified by:
      getId in interface Zone
    • getProperty

      public Object getProperty(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
    • removeProperty

      public void removeProperty(Object key)
      Removes a property.
      Specified by:
      removeProperty in interface Zone
      Parameters:
      key - the name of the property.
      See Also:
    • getPublicGroups

      public List<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 List<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 List<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:
    • 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(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 List<Room> getRoomList()
      Get the list of Rooms in the Zone
      Specified by:
      getRoomList in interface Zone
      Returns:
      the room list
    • getRoomListFromGroup

      public List<Room> getRoomListFromGroup(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 List<Room> getRoomListFromGroupList(Collection<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(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.util.IResponseThrottler getUCountThrottler()
      Specified by:
      getUCountThrottler in interface Zone
    • getDefaultPlayerIdGeneratorClassName

      public String getDefaultPlayerIdGeneratorClassName()
      Specified by:
      getDefaultPlayerIdGeneratorClassName in interface Zone
    • setDefaultPlayerIdGeneratorClassName

      public void setDefaultPlayerIdGeneratorClassName(String className)
      Specified by:
      setDefaultPlayerIdGeneratorClassName 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)
      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)
      Specified by:
      setLagMonitorKeepAlive in interface Zone
    • 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()
      Specified by:
      isHidden in interface Zone
    • setHidden

      public void setHidden(boolean flag)
      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:
    • 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:
    • getExtension

      public ISFSExtension getExtension()
      Specified by:
      getExtension in interface Zone
    • setExtension

      public void setExtension(ISFSExtension extension)
      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)
      Specified by:
      setUserReconnectionSeconds in interface Zone
    • 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)
      Specified by:
      setMaxUserIdleTime in interface Zone
    • getMaxUdpIdleSeconds

      public int getMaxUdpIdleSeconds()
      Get the max allowed idle seconds for the UDP connection. Any request sent from the client will reset the idle timer.
      Specified by:
      getMaxUdpIdleSeconds in interface Zone
      Returns:
      the time in seconds
    • isUdpKeepAlive

      public boolean isUdpKeepAlive()
      Specified by:
      isUdpKeepAlive in interface Zone
      Returns:
      true if the keep alive system is active for the UDP connection
    • setUdpKeepAlive

      public void setUdpKeepAlive(boolean value)
      Description copied from interface: Zone
      When true, sends a ping every few seconds to every UDP connection to keep it alive. This is only useful if the UDP communication is expected to have "gaps" for a some time (e.g. more than ten seconds). In most action games UDP updates happen at a constant rate and there is no need to use an extra keep-alive signal.

      Default value is false

      Specified by:
      setUdpKeepAlive in interface Zone
      Parameters:
      value -
    • setMaxUdpIdleSeconds

      public void setMaxUdpIdleSeconds(int seconds)
      Specified by:
      setMaxUdpIdleSeconds in interface Zone
    • getUsersInGroup

      public Collection<User> getUsersInGroup(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 Collection<ISession> getSessionsInGroup(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 Collection<ISession> getSessionsListeningToGroup(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 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 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.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
    • isClientAllowedToOverridRoomEvents

      public boolean isClientAllowedToOverridRoomEvents()
      Deprecated.
      Specified by:
      isClientAllowedToOverridRoomEvents in interface Zone
    • 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:
    • 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:
    • 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)
      Specified by:
      setFilterRoomNames in interface Zone
    • 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)
      Specified by:
      setFilterBuddyMessages in interface Zone
    • containsProperty

      public boolean containsProperty(Object key)
      Checks the existence of a Zone property
      Specified by:
      containsProperty in interface Zone
      Parameters:
      key - the name of the property
      Returns:
      true if the property exists
    • registerEventsForRoomGroup

      public void registerEventsForRoomGroup(String groupId, Set<SFSRoomEvents> flags)
      Specified by:
      registerEventsForRoomGroup in interface Zone
    • isGroupEventSet

      public boolean isGroupEventSet(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
    • getGroupEvents

      public Set<SFSRoomEvents> getGroupEvents(String groupId)
      Specified by:
      getGroupEvents in interface Zone
    • removeRoom

      public void removeRoom(int roomId)
      Specified by:
      removeRoom in interface Zone
    • removeRoom

      public void removeRoom(String name)
      Specified by:
      removeRoom in interface Zone
    • removeRoom

      public void removeRoom(Room room)
      Specified by:
      removeRoom in interface Zone
    • checkAndRemove

      public void checkAndRemove(Room room)
      Specified by:
      checkAndRemove in interface Zone
    • removeUserFromRoom

      public void removeUserFromRoom(User user, Room room)
      Specified by:
      removeUserFromRoom 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)
      Specified by:
      setMinRoomNameChars in interface Zone
    • 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)
      Specified by:
      setMaxRoomNameChars in interface Zone
    • getMaxUserNameChars

      public int getMaxUserNameChars()
      The maximum number of characters allowed for a User names
      Specified by:
      getMaxUserNameChars in interface Zone
      Returns:
      the maximum number of characters allowed for a User names
    • setMaxUserNameChars

      public void setMaxUserNameChars(int max)
      Specified by:
      setMaxUserNameChars in interface Zone
    • 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)
      Specified by:
      setId in interface Zone
    • setClientAllowedToOverridRoomEvents

      public void setClientAllowedToOverridRoomEvents(boolean flag)
      Deprecated.
      Specified by:
      setClientAllowedToOverridRoomEvents in interface Zone
    • setCustomLogin

      public void setCustomLogin(boolean flag)
      Specified by:
      setCustomLogin in interface Zone
    • setForceLogout

      public void setForceLogout(boolean flag)
      Specified by:
      setForceLogout in interface Zone
    • setGuestUserAllowed

      public void setGuestUserAllowed(boolean flag)
      Specified by:
      setGuestUserAllowed in interface Zone
    • setFilterUserNames

      public void setFilterUserNames(boolean flag)
      Specified by:
      setFilterUserNames in interface Zone
    • setGuestUserNamePrefix

      public void setGuestUserNamePrefix(String prefix)
      Specified by:
      setGuestUserNamePrefix in interface Zone
    • setMaxAllowedRooms

      public void setMaxAllowedRooms(int max)
      Specified by:
      setMaxAllowedRooms in interface Zone
    • setMaxAllowedUsers

      public void setMaxAllowedUsers(int max)
      Specified by:
      setMaxAllowedUsers in interface Zone
    • setMaxUserVariablesAllowed

      public void setMaxUserVariablesAllowed(int max)
      Specified by:
      setMaxUserVariablesAllowed in interface Zone
    • setMaxRoomsCreatedPerUserLimit

      public void setMaxRoomsCreatedPerUserLimit(int max)
      Specified by:
      setMaxRoomsCreatedPerUserLimit in interface Zone
    • setProperty

      public void setProperty(Object key, 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(List<String> groupIDs)
      Specified by:
      setPublicGroups in interface Zone
    • setDefaultGroups

      public void setDefaultGroups(List<String> groupIDs)
      Specified by:
      setDefaultGroups in interface Zone
    • setUserCountChangeUpdateInterval

      public void setUserCountChangeUpdateInterval(int interval)
      Specified by:
      setUserCountChangeUpdateInterval in interface Zone
    • setZoneManager

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

      public void validateUserName(String name) throws SFSException
      Specified by:
      validateUserName in interface Zone
      Throws:
      SFSException
    • getFloodFilter

      public IFloodFilter<?> getFloodFilter()
      Specified by:
      getFloodFilter in interface Zone
    • getWordFilter

      public com.smartfoxserver.util.IWordFilter getWordFilter()
      Specified by:
      getWordFilter in interface Zone
    • removeAllUsers

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

      public void removeUser(int userId)
      Specified by:
      removeUser in interface Zone
    • removeUser

      public void removeUser(ISession session)
      Specified by:
      removeUser in interface Zone
    • removeUser

      public void removeUser(String userName)
      Specified by:
      removeUser in interface Zone
    • removeUser

      public void removeUser(User user)
      Specified by:
      removeUser 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)
      Specified by:
      setMaxRoomVariablesAllowed in interface Zone
    • getPrivilegeManager

      public PrivilegeManager getPrivilegeManager()
      Specified by:
      getPrivilegeManager in interface Zone
    • setPrivilegeManager

      public void setPrivilegeManager(PrivilegeManager privilegeManager)
      Specified by:
      setPrivilegeManager in interface Zone
    • getBuddyListManager

      public BuddyListManager getBuddyListManager()
      Specified by:
      getBuddyListManager in interface Zone
    • setBuddyListManager

      public void setBuddyListManager(BuddyListManager buddyListManager)
      Specified by:
      setBuddyListManager in interface Zone
    • getDBManager

      public IDBManager getDBManager()
      Obtain a reference to the Zone's Database Manager.
      Specified by:
      getDBManager in interface Zone
      See Also:
    • setDBManager

      public void setDBManager(IDBManager manager)
      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)
      Specified by:
      setFilterPrivateMessages in interface Zone
    • login

      public User login(LoginData loginData) throws SFSLoginException
      Specified by:
      login in interface Zone
      Throws:
      SFSLoginException
    • getRoomListData

      public ISFSArray getRoomListData()
      Specified by:
      getRoomListData in interface Zone
    • getRoomListData

      public ISFSArray getRoomListData(List<String> groupIds)
      Specified by:
      getRoomListData in interface Zone
    • toString

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

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

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

      public void setAdminHelper(com.smartfoxserver.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
      Parameters:
      config - an optional config object. At the moment it is required only for DB_STORAGE mode only.
      See Also:
    • getRoomPersistenceApi

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

      Specified by:
      getRoomPersistenceApi in interface Zone
      Returns:
      the Room Persistence API object or null if the API was not initialized.
      See Also:
    • 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:
      true if protocol cryptography is turned on in this Zone
    • setEncrypted

      public void setEncrypted(boolean value)
      Specified by:
      setEncrypted in interface Zone
    • 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)
      Specified by:
      setMaxInvitationsPerRequest in interface Zone
    • 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)
      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)
      Specified by:
      setMaxFailedLogins in interface Zone
    • 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)
      Specified by:
      setGeoLocationEnabled in interface Zone
    • 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
      Returns:
      the max number of results for "Find User" requests from client side.
    • setMaxFindUserResults

      public void setMaxFindUserResults(int value)
      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
      Returns:
      the max number of results for "FindRoom" requests from client side.
    • setMaxFindRoomResults

      public void setMaxFindRoomResults(int value)
      Specified by:
      setMaxFindRoomResults in interface Zone
    • getRdpTxConfig

      public com.smartfoxserver.bitswarm.rdp.TransportConfig getRdpTxConfig()
      Specified by:
      getRdpTxConfig in interface Zone
    • setRdpTxConfig

      public void setRdpTxConfig(com.smartfoxserver.bitswarm.rdp.TransportConfig cfg)
      Specified by:
      setRdpTxConfig in interface Zone