javascript/features/playground/playground_commands.js
// Handles the |player| modifying the |setting|, which represents a boolean value.
Handles the |player| modifying the |setting|, which represents a boolean value.
Handles the |player| modifying the |setting| which represents a boolean value .
async handleBooleanSettingModification(player, setting) {
        const menu = new Menu(setting.description);
        const enableLabel = (setting.value ? '{FFFF00}' : '') + 'Enable' +
                            (setting.defaultValue ? ' {FFFFFF}(default)' : '');
        const disableLabel = (!setting.value ? '{FFFF00}' : '') + 'Disable' +
                             (!setting.defaultValue ? ' {FFFFFF}(default)' : '');
        menu.addItem(enableLabel, async(player) => {
            this.settings_().setValue(setting.identifier, true);
            this.announceSettingChangeToAdministrators(player, setting);
            return await MessageBox.display(player, {
                title: 'The setting has been enabled!',
                message: Message.format(Message.LVP_SETTING_TOGGLED, setting.identifier, 'enabled')
            });
        });
        menu.addItem(disableLabel, async(player) => {
            this.settings_().setValue(setting.identifier, false);
            this.announceSettingChangeToAdministrators(player, setting);
            return await MessageBox.display(player, {
                title: 'The setting has been disabled!',
                message: Message.format(Message.LVP_SETTING_TOGGLED, setting.identifier, 'disabled')
            });
        });
        await menu.displayForPlayer(player);
    }
async handleBooleanSettingModification ( player , setting ) { const menu = new Menu ( setting . description ) ; const enableLabel = ( setting . value ? '{FFFF00}' : '' ) + 'Enable' + ( setting . defaultValue ? ' {FFFFFF}(default)' : '' ) ; const disableLabel = ( ! setting . value ? '{FFFF00}' : '' ) + 'Disable' + ( ! setting . defaultValue ? ' {FFFFFF}(default)' : '' ) ; menu . addItem ( enableLabel , async ( player ) => { this . settings_ ( ) . setValue ( setting . identifier , true ) ; this . announceSettingChangeToAdministrators ( player , setting ) ; return await MessageBox . display ( player , { title : 'The setting has been enabled!' , message : Message . format ( Message . LVP_SETTING_TOGGLED , setting . identifier , 'enabled' ) } ) ; } ) ; menu . addItem ( disableLabel , async ( player ) => { this . settings_ ( ) . setValue ( setting . identifier , false ) ; this . announceSettingChangeToAdministrators ( player , setting ) ; return await MessageBox . display ( player , { title : 'The setting has been disabled!' , message : Message . format ( Message . LVP_SETTING_TOGGLED , setting . identifier , 'disabled' ) } ) ; } ) ; await menu . displayForPlayer ( player ) ; }
Handles the |player| modifying the |setting|, which represents a boolean value.
Handles the |player| modifying the |setting| which represents a boolean value .
// Create creative labels that describe both the current value, the new value and the // default value that was configured for the setting in its entirety.