Class CreateRoomSettings

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    CreateMMORoomSettings, CreateSFSGameSettings

    public class CreateRoomSettings
    extends java.lang.Object
    implements java.io.Serializable
    The Room Settings allow you to configure how a new Room will work under many different aspects, from its size to the events it can fire, permissions and a lot more.

    Basic Settings

    A minimal Room configuration should always contain the following parameters:
    • name: the name of the Room, must be unique
    • password: (optional) a password should be specified for private Rooms
    • maxUsers: the maximum number of Users allowed in the Room
    • maxVariablesAllowed: the maximum number of RoomVariable allowed in the Room
    • isGame: (optional) if the Room is going to be used for games this flag should be set to true
    • maxSpectators: (optional) if this is a Game Room you should configure how many spectators are allowed inside

    More Settings

    The following settings will help you define other important features of a Room
    • autoRemoveMode: turns on/off the auto-remove-mode which allows Rooms to be destroyed when appropriate
    • roomVariables: provide a list of RoomVariable that will be added to the Room
    • extension: dynamically attach a Server-Side extension to the Room, adding custom logic for your games

    Advanced Settings

    The following settings will help you define the advanced aspects of each Room
    • roomSettings: allow to specify permissions and events used by the Room.
    • badWordsFilter: configure the bad words filtering options
    • customPlayerIdGeneratorClass: provide a custom Class that handles the generation of playerId(s) for Game Rooms
    See Also:
    Serialized Form
    • Constructor Detail

      • CreateRoomSettings

        public CreateRoomSettings()
    • Method Detail

      • getName

        public java.lang.String getName()
        Get the name of the Room. Room names must be unique, although they are not cases-sensitive. In other words this means that a Room called "My House" will not collide with a Room called "MY HOUSE"
        Returns:
        the Room bame
      • setName

        public void setName​(java.lang.String name)
        Set the name of the Room. Room names must be unique, although they are not cases-sensitive. In other words this means that a Room called "My House" will not collide with a Room called "MY HOUSE"
        Parameters:
        name - the name of the new Room
      • getGroupId

        public java.lang.String getGroupId()
        The name of the Room Group that the new Room will be assigned to.
        Returns:
        the group Id
      • setGroupId

        public void setGroupId​(java.lang.String groupId)
        Set the name of the Room Group that the new Room will be assigned to. A value of null will indicate the "default" Group. If the group doesn't exist it will be created (server side only)
        Parameters:
        groupId -
      • getPassword

        public java.lang.String getPassword()
        Get the Room password.
        Returns:
        the Room password, or null if no password was assigned to the Room
      • setPassword

        public void setPassword​(java.lang.String password)
        Set the Room password
        Parameters:
        password - the password to join the Room
      • getMaxUsers

        public int getMaxUsers()
        Get the maximum number of users allowed in the Room
        Returns:
        the maximum number of users allowed in the Room
      • setMaxUsers

        public void setMaxUsers​(int maxUsers)
        Set the maximum number of users allowed in the Room
        Parameters:
        maxUsers - the maximum number of users allowed in the Room
      • getMaxSpectators

        public int getMaxSpectators()
        Get the maximum number of spectators allowed in the Room (game only)
      • setMaxSpectators

        public void setMaxSpectators​(int maxSpectators)
        Set the maximum number of spectators allowed in the Room (game only)
        Parameters:
        maxSpectators - the maximum number of spectators allowed in the Room
      • isDynamic

        public boolean isDynamic()
        A dynamic Room is created at runtime by either a client request or a server side "CreateRoom" command.

        NOTE: When the flag is turned off the Room is considered "static" and therefore never removed. In other words the AutoRemoveMode parameter will be ignored.

        Returns:
        true, if the Room was created dynamically.
      • setDynamic

        public void setDynamic​(boolean isDynamic)
        Set the Room as dynamic. Dynamic Rooms can be auto-removed by the Room Manager according to the specified rules. Non-dynamic Room can only be removed manually either via code or from the Admin Tool.
        Parameters:
        isDynamic -
      • isGame

        public boolean isGame()
        Check if the Room is a game.
        Returns:
        true if the Room is a Game Room
      • setGame

        public void setGame​(boolean isGame)
        Set the Room as a Game Room.
        Parameters:
        isGame -
      • isHidden

        public boolean isHidden()
        The hidden flag allows to conceal one or more Rooms from the Room List. Hidden Rooms are sent to the client with the initial Room List. The developer can detect the hidden flag and avoid to show them in the GUI.
        Returns:
        true if the Room is hidden
      • setHidden

        public void setHidden​(boolean isHidden)
        Set the Room as hidden. Hidden Rooms are sent to the client with the initial Room List. The developer can detect the hidden flag and avoid to show them in the GUI.
        Parameters:
        isHidden -
      • setAutoRemoveMode

        public void setAutoRemoveMode​(SFSRoomRemoveMode autoRemoveMode)
        Set the Auto-Remove mode of the Room for a dynamic Room.

        Dynamic rooms can be auto-removed with different rules. Make sure the isDynamic flag is also turned on to activate the Auto-Remove.

        Parameters:
        autoRemoveMode - the Auto-Remove mode of the Room
        See Also:
        SFSRoomRemoveMode, setDynamic(boolean)
      • getRoomSettings

        public java.util.Set<SFSRoomSettings> getRoomSettings()
        Get the advanced settings of the Room. These flags allow to configure which events the Room will broadcast and which operations are allowed in the Room itself.
        Returns:
        a Set of advanced Room settings (those present in the Set are active, those missing are inactive)
        See Also:
        SFSRoomSettings
      • setRoomSettings

        public void setRoomSettings​(java.util.Set<SFSRoomSettings> roomSettings)
        Set the advanced settings of the Room. These flags allow to configure which events the Room will broadcast and which operations are allowed in the Room itself.

        You can use the EnumSet.of() method to easily concatenate multiple flags in a one line expression.

        Parameters:
        roomSettings - a List of settings that are active.
        See Also:
        EnumSet.of(Enum)
      • isUseWordsFilter

        public boolean isUseWordsFilter()
        Check if the word filter is used in this Room (applied to Public Messages)
        Returns:
        true if the word filter is used in this Room (applied to Public Messages)
      • setUseWordsFilter

        public void setUseWordsFilter​(boolean useWordsFilter)
        Toggle the word filter in this Room (applied to Public Messages)
        Parameters:
        useWordsFilter -
      • getRoomVariables

        public java.util.List<RoomVariable> getRoomVariables()
        Get the list of Room Variables for the new Room
        Returns:
        the list of Room Variables for the new Room
        See Also:
        SFSRoomVariable
      • setRoomVariables

        public void setRoomVariables​(java.util.List<RoomVariable> roomVariables)
        Set one or more Room Variables in the new Room
        Parameters:
        roomVariables - a list of Room Variables
        See Also:
        SFSRoomVariable
      • getMaxVariablesAllowed

        public int getMaxVariablesAllowed()
        Get the maximum number of Room Variables allowed
        Returns:
        the maximum number of Room Variables allowed
      • setMaxVariablesAllowed

        public void setMaxVariablesAllowed​(int maxVariablesAllowed)
        Set the maximum number of Room Variables allowed
        Parameters:
        maxVariablesAllowed - the maximum number of Room Variables allowed
      • getCustomPlayerIdGeneratorClass

        public java.lang.Class<? extends IPlayerIdGenerator> getCustomPlayerIdGeneratorClass()
        Get the PlayerId Generator class.
        Returns:
        the player id generator
        See Also:
        IPlayerIdGenerator
      • setCustomPlayerIdGeneratorClass

        public void setCustomPlayerIdGeneratorClass​(java.lang.Class<? extends IPlayerIdGenerator> customPlayerIdGeneratorClass)
        All Game Rooms by default use the SFS2X default PlayerId Generator class. Developers can specify their own implementation and override the default class.
        Parameters:
        customPlayerIdGeneratorClass - the custom PlayerId Generator implementation
        See Also:
        IPlayerIdGenerator
      • getRoomProperties

        public java.util.Map<java.lang.Object,​java.lang.Object> getRoomProperties()
        Get the custom properties attached to the Room object
        Returns:
        the custom properties
        Since:
        2.8.0
      • setRoomProperties

        public void setRoomProperties​(java.util.Map<java.lang.Object,​java.lang.Object> roomProperties)
        Allows to set a number of custom properties that will be available in the Room Extension
        Parameters:
        roomProperties - a map of custom properties
      • isSuppressUserList

        public boolean isSuppressUserList()
        Check whether or not the client side User list is suppressed for this Room
        Returns:
        true if the list is suppressed
      • setSuppressUserList

        public void setSuppressUserList​(boolean value)
        Used to suppress the User list on the client side, for special use cases when Rooms are not used for User interaction.

        When set to true this will suppress the User list sent by the server on ROOM_JOIN event as well as the USER_ENTER and USER_EXIT events.

        NOTE: This is does not work with MMORooms.

        Parameters:
        value - true to suppress the User list and related update events (default = false)
        Since:
        2.18.2
      • toString

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