private void OnTeamOutfitChangeEvent(object sender, ScrimMessageEventArgs <TeamOutfitChangeMessage> e)
        {
            if (MatchConfiguration.IsManualWorldId)
            {
                return;
            }

            int?worldId;

            var  message    = e.Message;
            var  changeType = message.ChangeType;
            bool isRollBack = false;

            if (changeType == TeamChangeType.Add)
            {
                worldId = e.Message.Outfit.WorldId;
            }
            else
            {
                worldId    = _teamsManager.GetNextWorldId(MatchConfiguration.WorldId);
                isRollBack = true;
            }

            if (worldId == null)
            {
                MatchConfiguration.ResetWorldId();
                SendMatchConfigurationUpdateMessage();
            }
            else if (MatchConfiguration.TrySetWorldId((int)worldId, false, isRollBack))
            {
                SendMatchConfigurationUpdateMessage();
            }
        }
        public async Task ClearMatch(bool isRematch)
        {
            if (_isRunning)
            {
                await EndRound();
            }

            _wsMonitor.DisableScoring();
            if (!isRematch)
            {
                _wsMonitor.RemoveAllCharacterSubscriptions();
            }
            _messageService.DisableLogging();

            var previousWorldId         = MatchConfiguration.WorldIdString;
            var previousIsManualWorldId = MatchConfiguration.IsManualWorldId;

            var previousEndRoundOnFacilityCapture         = MatchConfiguration.EndRoundOnFacilityCapture;
            var previousIsManualEndRoundOnFacilityCapture = MatchConfiguration.EndRoundOnFacilityCapture;

            MatchConfiguration = new MatchConfiguration();

            if (isRematch)
            {
                MatchConfiguration.TrySetWorldId(previousWorldId, previousIsManualWorldId);
                MatchConfiguration.TrySetEndRoundOnFacilityCapture(previousEndRoundOnFacilityCapture, previousIsManualEndRoundOnFacilityCapture);
            }
            else
            {
                var activeRuleset = await _rulesetManager.GetActiveRulesetAsync();

                MatchConfiguration.TrySetEndRoundOnFacilityCapture(activeRuleset.DefaultEndRoundOnFacilityCapture, false);
            }

            _roundSecondsMax = MatchConfiguration.RoundSecondsTotal;

            _matchState   = MatchState.Uninitialized;
            _currentRound = 0;

            _matchDataService.CurrentMatchRound = _currentRound;
            _matchDataService.CurrentMatchId    = string.Empty;

            _latestTimerTickMessage = null;

            if (isRematch)
            {
                _teamsManager.UpdateAllTeamsMatchSeriesResults(CurrentSeriesMatch);
                _teamsManager.ResetAllTeamsMatchData();
            }
            else
            {
                CurrentSeriesMatch = 0;

                _teamsManager.ClearAllTeams();
            }

            SendMatchStateUpdateMessage();
            SendMatchConfigurationUpdateMessage();
        }
        public void PostBase([FromBody] string newBase)
        {
            var oldBase = _configuration.FacilityIdString;

            if (_configuration.TrySetWorldId(19, true, false))
            {
                if (oldBase != newBase)
                {
                    _configuration.FacilityIdString = newBase;
                    _messageService.BroadcastMatchConfigurationUpdateMessage(new MatchConfigurationUpdateMessage(_configuration));
                }
            }
        }