Class KickUserRequest

  • All Implemented Interfaces:
    sfs2x.client.requests.IRequest

    public class KickUserRequest
    extends BaseRequest
    Kicks a user out of the server.

    The current user must have administration or moderation privileges in order to be able to kick another user (see the User.privilegeId property). The request allows sending a message to the kicked user (to make clear the reason of the following disconnection) which is delivered by means of the moderatorMessage event.

    Differently from the user being banned (see the BanUserRequest request), a kicked user will be able to reconnect to the SmartFoxServer instance immediately.

    Example
    The following example kicks the user Jack from the system:

     private void someMethod() {
         User userToKick = sfs.getUserManager().getUserByName("Jack");
         sfs.send(new KickUserRequest(userToKick.getId()));
     }
     
    See Also:
    SFSEvent.MODERATOR_MESSAGE, User.getPrivilegeId(), BanUserRequest
    • Field Detail

      • KEY_USER_ID

        public static final java.lang.String KEY_USER_ID
        * API internal usage only *
        See Also:
        Constant Field Values
      • KEY_MESSAGE

        public static final java.lang.String KEY_MESSAGE
        * API internal usage only *
        See Also:
        Constant Field Values
      • KEY_DELAY

        public static final java.lang.String KEY_DELAY
        * API internal usage only *
        See Also:
        Constant Field Values
    • Constructor Detail

      • KickUserRequest

        public KickUserRequest​(int userId,
                               java.lang.String message,
                               int delaySeconds)
        Creates a new KickUserRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.
        Parameters:
        userId - The id of the user to be kicked.
        message - A custom message to be delivered to the user before kicking him; if null, the default message configured in the SmartFoxServer 2X Administration Tool is used.
        delaySeconds - The number of seconds after which the user is kicked after receiving the kick message.
        See Also:
        SmartFox.send(sfs2x.client.requests.IRequest)
    • Method Detail

      • validate

        public void validate​(ISmartFox sfs)
                      throws sfs2x.client.exceptions.SFSValidationException
        * API internal usage only *
        Throws:
        sfs2x.client.exceptions.SFSValidationException
      • execute

        public void execute​(ISmartFox sfs)
        * API internal usage only *