예제 #1
0
        protected override void PrepareSystem()
        {
            if (IsClient)
            {
                BootstrapperClientGame.InitCallback += _ => RefreshWelcomeMessage();
                return;
            }

            serverWelcomeMessageText = SharedTextHelper.TrimAndFilterProfanity(Api.Server.Core.WelcomeMessageText);
            serverDescriptionText    = SharedTextHelper.TrimAndFilterProfanity(Api.Server.Core.DescriptionMessageText);
            Server.Database.TryGet(ServerDatabaseScheduledWipeDateUtcPrefixAndKey,
                                   ServerDatabaseScheduledWipeDateUtcPrefixAndKey,
                                   out DateTime? wipeDateUtc);

            if (wipeDateUtc.HasValue &&
                wipeDateUtc.Value < DateTime.Now)
            {
                // the scheduled wipe date is in the past and no longer valid
                wipeDateUtc = null;
            }

            ServerScheduledWipeDateUtc = wipeDateUtc;

            NextWipeDateServerTagHelper.ServerRefreshServerInfoTagForNextWipeDate();
        }
예제 #2
0
        protected override void PrepareSystem()
        {
            if (IsServer)
            {
                serverWelcomeMessageText = SharedTextHelper.TrimAndFilterProfanity(Api.Server.Core.WelcomeMessageText);
                serverDescriptionText    = SharedTextHelper.TrimAndFilterProfanity(Api.Server.Core.DescriptionMessageText);
                Server.Database.TryGet(ServerDatabaseScheduledWipeDateUtcPrefixAndKey,
                                       ServerDatabaseScheduledWipeDateUtcPrefixAndKey,
                                       out DateTime? wipeDateUtc);

                if (wipeDateUtc.HasValue &&
                    wipeDateUtc.Value < DateTime.Now)
                {
                    // the scheduled wipe date is in the past and no longer valid
                    wipeDateUtc = null;
                }

                ServerScheduledWipeDateUtc = wipeDateUtc;

                NextWipeDateServerTagHelper.ServerRefreshServerInfoTagForNextWipeDate();
                return;
            }

            Client.Characters.CurrentPlayerCharacterChanged += Refresh;

            void Refresh()
            {
                if (Api.Client.Characters.CurrentPlayerCharacter is not null)
                {
                    RefreshWelcomeMessage();
                }
            }
        }