Interface Zone

All Known Implementing Classes:
SFSZone

public interface Zone
  • Method Details

    • getUserManager

      com.smartfoxserver.entities.managers.IUserManager getUserManager()
      Internal
    • 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)
      Internal
    • getName

      String getName()
      The name of the Zone. Each Zone must have a unique name.
      Returns:
      the name of the Zone.
    • getId

      int getId()
      Internal
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • getMaxUserNameChars

      int getMaxUserNameChars()
      The maximum number of characters allowed for a User names
      Returns:
      the maximum number of characters allowed for a User names
    • setMaxUserNameChars

      void setMaxUserNameChars(int max)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • getMaxUdpIdleSeconds

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

      boolean isUdpKeepAlive()
      Returns:
      true if the keep alive system is active for the UDP connection
    • setUdpKeepAlive

      void setUdpKeepAlive(boolean value)
      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

      Parameters:
      value -
    • setMaxUdpIdleSeconds

      void setMaxUdpIdleSeconds(int seconds)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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:
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • setCustomLogin

      void setCustomLogin(boolean flag)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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:
    • setGuestUserAllowed

      void setGuestUserAllowed(boolean flag)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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)
      Internal
    • getGuestUserNamePrefix

      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(String prefix)
      Internal
    • getDefaultPlayerIdGeneratorClassName

      String getDefaultPlayerIdGeneratorClassName()
      Internal
    • setDefaultPlayerIdGeneratorClassName

      void setDefaultPlayerIdGeneratorClassName(String className)
      Internal
    • isUploadEnabled

      boolean isUploadEnabled()
      True if the Zone supports HTTP uploads.
      Returns:
      true if the Zone supports HTTP uploads.
    • setUploadEnabled

      void setUploadEnabled(boolean val)
      Internal
    • isGeoLocationEnabled

      boolean isGeoLocationEnabled()
      Toggles geolocation for clients.
      Returns:
      true if geolocation is enabled in this Zone
      Since:
      2.12
    • setGeoLocationEnabled

      void setGeoLocationEnabled(boolean value)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • getPublicGroups

      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.
      Returns:
      the list of group ids
    • setPublicGroups

      void setPublicGroups(List<String> groupIDs)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • getGroups

      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
      Returns:
      the list of Room Groups
    • getDefaultGroups

      List<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:
    • setDefaultGroups

      void setDefaultGroups(List<String> groupIDs)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • getPrivilegeManager

      PrivilegeManager getPrivilegeManager()
      Internal
    • setPrivilegeManager

      void setPrivilegeManager(PrivilegeManager privilegeManager)
      Internal
    • 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()
      Returns:
      the total number of Rooms
    • getGameRoomCount

      int getGameRoomCount()
      Returns:
      the total number of game Rooms
    • createRoom

      Room createRoom(CreateRoomSettings params) throws SFSCreateRoomException
      Throws:
      SFSCreateRoomException
      Internal
      Use this instead: SFSApi.createRoom(Zone, CreateRoomSettings, User)
    • createRoom

      Room createRoom(CreateRoomSettings params, User user) throws SFSCreateRoomException
      Throws:
      SFSCreateRoomException
      Internal
      Use this instead: SFSApi.createRoom(Zone, CreateRoomSettings, User)
    • isClientAllowedToOverridRoomEvents

      boolean isClientAllowedToOverridRoomEvents()
      Internal
    • setClientAllowedToOverridRoomEvents

      void setClientAllowedToOverridRoomEvents(boolean flag)
      Internal
    • registerEventsForRoomGroup

      void registerEventsForRoomGroup(String groupId, Set<SFSRoomEvents> flags)
      Internal
    • isGroupEventSet

      boolean isGroupEventSet(String groupId, SFSRoomEvents eventToCheck)
      Checks whether a specific Room Event for the specified Group is active
      Parameters:
      groupId - the group name
      eventToCheck - the type of event to check
      Returns:
      true if the event is active
    • getGroupEvents

      Set<SFSRoomEvents> getGroupEvents(String groupId)
      Internal
    • getRoomManager

      com.smartfoxserver.entities.managers.IRoomManager getRoomManager()
      Internal
    • containsGroup

      boolean containsGroup(String groupId)
      Check if the Zone contains the specified Group
      Returns:
      true if the Zone contains the specified Group
    • containsPublicGroup

      boolean containsPublicGroup(String groupId)
      Check if the Zone contains the specified public Group
      Returns:
      true if the Zone contains the specified public Group
    • getProperty

      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...
      Parameters:
      key - the name of the property
      Returns:
      the value of the property, null if the property doesn't exist
    • setProperty

      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...
      Parameters:
      key - the name of the property
      value - the value of the property
    • containsProperty

      boolean containsProperty(Object key)
      Checks the existence of a Zone property
      Parameters:
      key - the name of the property
      Returns:
      true if the property exists
    • removeProperty

      void removeProperty(Object key)
      Removes a property.
      Parameters:
      key - the name of the property.
      See Also:
    • getZoneManager

      com.smartfoxserver.entities.managers.IZoneManager getZoneManager()
      Internal
    • setZoneManager

      void setZoneManager(com.smartfoxserver.entities.managers.IZoneManager manager)
      Internal
    • getRoomList

      List<Room> getRoomList()
      Get the list of Rooms in the Zone
      Returns:
      the room list
    • getRoomListFromGroup

      List<Room> getRoomListFromGroup(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

      List<Room> getRoomListFromGroupList(Collection<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(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
      Throws:
      SFSTooManyRoomsException
      Internal

      Instead use SFSApi.createRoom(Zone, CreateRoomSettings, User)

    • removeRoom

      void removeRoom(Room room)
      Internal

      Instead use SFSApi.removeRoom(Room)

    • removeRoom

      void removeRoom(int roomId)
      Internal

      Instead use SFSApi.removeRoom(Room)

    • removeRoom

      void removeRoom(String name)
      Internal

      Instead use SFSApi.removeRoom(Room)

    • checkAndRemove

      void checkAndRemove(Room room)
    • changeRoomName

      void changeRoomName(Room room, String newName) throws SFSRoomException
      Throws:
      SFSRoomException
      Internal

      Instead use SFSApi.changeRoomName(User, Room, String)

    • changeRoomPasswordState

      void changeRoomPasswordState(Room room, String password)
      Internal

      Instead use SFSApi.changeRoomPassword(User, Room, String)

    • changeRoomCapacity

      void changeRoomCapacity(Room room, int newMaxUsers, int maxMaxSpect)
      Internal

      Instead use SFSApi.changeRoomCapacity(User, Room, int, int)

    • validateUserName

      void validateUserName(String name) throws SFSException
      Throws:
      SFSException
      Internal
    • 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(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

      Collection<User> getUsersInGroup(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

      Collection<ISession> getSessionsInGroup(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

      Collection<ISession> getSessionsListeningToGroup(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

      Collection<ISession> getSessionList()
      Get the list of Sessions logged in the Zone
      Returns:
      the list of Sessions logged in the Zone
    • getUserList

      Collection<User> getUserList()
      Get the list of Users logged in the Zone
      Returns:
      the list of Users logged in the Zone
    • removeAllUsers

      void removeAllUsers()
      Internal
    • 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
      See Also:
    • 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 Id
      chain - the filter chain
      See Also:
    • isFilterChainInited

      boolean isFilterChainInited()
      Returns true if the FilterChain was initialized
      Returns:
      true if at least one Filter was added to the FilterChain
    • resetSystemFilterChain

      void resetSystemFilterChain()
      Resets the whole SystemController Filter chain. All filters for any SystemRequest is removed.
    • removeUser

      void removeUser(int userId)
      Internal

      Instead use SFSApi.disconnectUser(User)

    • removeUser

      void removeUser(String userName)
      Internal

      Instead use SFSApi.disconnectUser(User)

    • removeUser

      void removeUser(ISession session)
      Internal

      Instead use SFSApi.disconnect(ISession)

    • removeUser

      void removeUser(User user)
      Internal

      Instead use SFSApi.disconnectUser(User)

    • removeUserFromRoom

      void removeUserFromRoom(User user, Room room)
      Internal

      Instead use SFSApi.leaveRoom(User, Room)

    • getUCountThrottler

      com.smartfoxserver.util.IResponseThrottler getUCountThrottler()
      Internal
    • getWordFilter

      com.smartfoxserver.util.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:
    • 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.
      See Also:
    • 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.
      See Also:
    • login

      User login(LoginData loginData) throws SFSLoginException
      Throws:
      SFSLoginException
      Internal

      Instead use SFSApi.login(ISession, String, String, String, com.smartfoxserver.entities.data.ISFSObject)

    • getRoomListData

      ISFSArray getRoomListData()
      Internal
    • getRoomListData

      ISFSArray getRoomListData(List<String> groupIds)
      Internal
    • getBuddyListManager

      BuddyListManager getBuddyListManager()
      Internal

      Instead 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:
      true if protocol cryptography is turned on in this Zone
    • setEncrypted

      void setEncrypted(boolean value)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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
    • setMaxInvitationsPerRequest

      void setMaxInvitationsPerRequest(int maxInvitationsPerRequest)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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.
    • setAllowInvitationsOnlyForBuddies

      void setAllowInvitationsOnlyForBuddies(boolean allowInvitationsOnlyForBuddies)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • 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.
    • setMaxFailedLogins

      void setMaxFailedLogins(int value)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • getMaxFindUserResults

      int getMaxFindUserResults()
      Get the max number of "Find User" results for a client request. Default is 50.
      Returns:
      the max number of results for "Find User" requests from client side.
    • setMaxFindUserResults

      void setMaxFindUserResults(int value)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • getMaxFindRoomResults

      int getMaxFindRoomResults()
      Get the max number of "FindRoom" results for a client request. Default is 50.
      Returns:
      the max number of results for "FindRoom" requests from client side.
    • setMaxFindRoomResults

      void setMaxFindRoomResults(int value)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • isLagMonitorKeepAlive

      boolean isLagMonitorKeepAlive()
      Returns true if the LagMonitor requests are also actively resetting the User's idle timer
    • setLagMonitorKeepAlive

      void setLagMonitorKeepAlive(boolean value)
      Internal
      Use the AdminTool's Zone Configurator to change this value
    • getRdpTxConfig

      com.smartfoxserver.bitswarm.rdp.TransportConfig getRdpTxConfig()
      Internal
    • setRdpTxConfig

      void setRdpTxConfig(com.smartfoxserver.bitswarm.rdp.TransportConfig cfg)
      Internal
    • getDump

      String getDump()
      Internal