Interface IClusterApi


  • public interface IClusterApi
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void createRoom​(com.smartfoxserver.v2.api.CreateRoomSettings settings, com.smartfoxserver.v2.entities.User owner)
      Invoked from: Lobby Node only
      void dispatchGameEventToLobby​(java.util.Map<java.lang.String,​java.lang.Object> params)
      Invoked from: Game Node only
      int getGameNodeCount()
      Invoked from: Lobby Node only
      IClusterResponseApi getResponseApi()  
      int getTotalClusterUserCount()
      Invoked from: Lobby Node only
      void joinRoom​(java.lang.String serverId, com.smartfoxserver.v2.entities.User user, int roomId)
      Invoked from: Lobby Node only
      void joinRoom​(java.lang.String serverId, com.smartfoxserver.v2.entities.User user, int roomId, boolean asSpectator)
      Invoked from: Lobby Node only
      void quickJoinOrCreateRoom​(com.smartfoxserver.v2.entities.User player, com.smartfoxserver.v2.entities.match.MatchExpression expression, java.util.List<java.lang.String> groupList, com.smartfoxserver.v2.api.CreateRoomSettings settings)
      Invoked from: Lobby Node only
      void quickJoinOrCreateRoom​(com.smartfoxserver.v2.entities.User player, com.smartfoxserver.v2.entities.match.MatchExpression expression, java.util.List<java.lang.String> groupList, com.smartfoxserver.v2.api.CreateRoomSettings settings, boolean fireClientError)
      Invoked from: Lobby Node only
      void sendJoinInvitation​(com.smartfoxserver.v2.entities.invitation.Invitation invitation, IClusterTarget target)
      Invoked from: Lobby Node only
      void sendJoinInvitation​(com.smartfoxserver.v2.entities.User inviter, java.util.List<com.smartfoxserver.v2.entities.User> invitees, IClusterTarget target, int expirySeconds, com.smartfoxserver.v2.entities.data.ISFSObject params)
      Invoked from: Lobby Node only
    • Method Detail

      • getGameNodeCount

        int getGameNodeCount()

        Invoked from: Lobby Node only

        Get the number of Game nodes currently active
        Returns:
        the number of Game nodes currently active
      • getTotalClusterUserCount

        int getTotalClusterUserCount()

        Invoked from: Lobby Node only

        Obtain the total number of players on all game nodes
        Returns:
        the total number of players on all game nodes
      • createRoom

        void createRoom​(com.smartfoxserver.v2.api.CreateRoomSettings settings,
                        com.smartfoxserver.v2.entities.User owner)

        Invoked from: Lobby Node only

        Parameters:
        settings - the room settings
        owner - the owner of the Room (if null the Room is owned by the Server)
      • quickJoinOrCreateRoom

        void quickJoinOrCreateRoom​(com.smartfoxserver.v2.entities.User player,
                                   com.smartfoxserver.v2.entities.match.MatchExpression expression,
                                   java.util.List<java.lang.String> groupList,
                                   com.smartfoxserver.v2.api.CreateRoomSettings settings)

        Invoked from: Lobby Node only

        Searches for one or more Rooms matching the criteria provided in the MatchExpression and join the first available. If no Room is found create a new Room with the settings provided.

        Possible client side events:

        • ROOM_JOIN: if the Room is joined successfully
        • ROOM_JOIN_ERROR: if an error occurred while attempting to join the Room
        • ROOM_CREATION_ERROR: if an error occurs while attempting to create the new Room
        Parameters:
        player - the User requesting to join
        expression - a MatchExpression used to filter Rooms for specific criteria
        groupList - List of Room Groups where to search
        settings - the settings to use when creating a new Room
      • quickJoinOrCreateRoom

        void quickJoinOrCreateRoom​(com.smartfoxserver.v2.entities.User player,
                                   com.smartfoxserver.v2.entities.match.MatchExpression expression,
                                   java.util.List<java.lang.String> groupList,
                                   com.smartfoxserver.v2.api.CreateRoomSettings settings,
                                   boolean fireClientError)

        Invoked from: Lobby Node only

        Searches for one or more Rooms matching the criteria provided in the MatchExpression and join the first available. If no Room is found create a new Room with the settings provided.

        Possible client side events:

        • ROOM_JOIN: if the Room is joined successfully
        • ROOM_JOIN_ERROR: if an error occurred while attempting to join the Room
        • ROOM_CREATION_ERROR: if an error occurs while attempting to create the new Room
        Parameters:
        player - the User requesting to join
        expression - a MatchExpression used to filter Rooms for specific criteria
        groupList - a list of Room Groups where to search
        settings - the settings to use when creating a new Room
        fireClientError - if true, notify a SFSClusterEvent.LOAD_BALANCER_ERROR to the client
      • joinRoom

        void joinRoom​(java.lang.String serverId,
                      com.smartfoxserver.v2.entities.User user,
                      int roomId,
                      boolean asSpectator)

        Invoked from: Lobby Node only

        NOTE: normally you don't need to call this method as joining is already done for you behind the scenes when using the matchmaking calls from either client or server side. For example using the quickJoinOrCreateRoom method.

        Parameters:
        serverId - id of the target Game Node
        user - the player
        roomId - the id of the Room to join
        asSpectator - true, if the player should join as spectator rather than player
      • joinRoom

        void joinRoom​(java.lang.String serverId,
                      com.smartfoxserver.v2.entities.User user,
                      int roomId)

        Invoked from: Lobby Node only

        NOTE: normally you don't need to call this method as joining is already done for you behind the scenes when using the matchmaking calls from either client or server side. For example using the quickJoinOrCreateRoom method.

        Parameters:
        serverId - id of the target Game Node
        user - the player
        roomId - the id of the target Room
      • sendJoinInvitation

        void sendJoinInvitation​(com.smartfoxserver.v2.entities.invitation.Invitation invitation,
                                IClusterTarget target)

        Invoked from: Lobby Node only

        Send a Join Invitation to a single User.
        Invites another User to join a specific Room

        Parameters:
        invitation - the Invitation
        target - the target Room/Server id of the invitation
        See Also:
        SFSInvitation, InvitationCallback
      • sendJoinInvitation

        void sendJoinInvitation​(com.smartfoxserver.v2.entities.User inviter,
                                java.util.List<com.smartfoxserver.v2.entities.User> invitees,
                                IClusterTarget target,
                                int expirySeconds,
                                com.smartfoxserver.v2.entities.data.ISFSObject params)

        Invoked from: Lobby Node only

        Send a Join Invitation to a List of Users
        Invites multiple Users to join a specific Room

        Parameters:
        inviter - the Inviter
        invitees - the Invitee
        target - the target Room/Server id of the invitation
        expirySeconds - the amount of time allowed for the Invitee to accept or refuse the invitation
        params - custom Invitation parameters
        See Also:
        SFSInvitation, InvitationCallback
      • dispatchGameEventToLobby

        void dispatchGameEventToLobby​(java.util.Map<java.lang.String,​java.lang.Object> params)

        Invoked from: Game Node only

        Notifies a custom event from a Game Node back to the Lobby Zone Extension. If you're running multiple Zones on the Lobby side, all of them will receive the event, provided they have an active Zone-level Extension.

        This method is more conveniently invoked from any class extending SFSClusterGameExtension.
        Parameters:
        params - a Map of parameters associated with the event. NOTE: every object in the Map must be Serializable.