Пример #1
0
        private void OnUpdate()
        {
            UpdateManager.UpdateProcedureCheck();
            StatTracker.checkin();
            if (Backups.IsBackupTime)
            {
                Backups.Backup();
            }

            //call these every second, not every update
            if ((DateTime.UtcNow - LastCheck).TotalSeconds >= 1)
            {
                OnSecondUpdate();
                LastCheck = DateTime.UtcNow;
            }

            if ((DateTime.UtcNow - LastSave).TotalMinutes >= 15)
            {
                foreach (TSPlayer player in TShock.Players)
                {
                    // prevent null point exceptions
                    if (player != null && player.IsLoggedIn)
                    {
                        TShock.InventoryDB.InsertPlayerData(player);
                    }
                }
                LastSave = DateTime.UtcNow;
            }
        }
Пример #2
0
        private void OnUpdate()
        {
            UpdateManager.UpdateProcedureCheck();

            if (Backups.IsBackupTime)
            {
                Backups.Backup();
            }

            //call these every second, not every update
            if ((DateTime.UtcNow - LastCheck).TotalSeconds >= 1)
            {
                LastCheck = DateTime.UtcNow;
                foreach (TSPlayer player in Players)
                {
                    if (player != null && player.Active)
                    {
                        if (player.TilesDestroyed != null)
                        {
                            if (player.TileThreshold >= Config.TileThreshold)
                            {
                                if (Tools.HandleTntUser(player, "Kill tile abuse detected."))
                                {
                                    TSPlayer.Server.RevertKillTile(player.TilesDestroyed);
                                }
                            }
                            if (player.TileThreshold > 0)
                            {
                                player.TileThreshold = 0;
                                player.TilesDestroyed.Clear();
                            }
                        }

                        /*if (CheckPlayerCollision(player.TileX, player.TileY))
                         *  player.SendMessage("You are currently nocliping!", Color.Red);*/
                        if (player.ForceSpawn && (DateTime.Now - player.LastDeath).Seconds >= 3)
                        {
                            player.Spawn();
                            player.ForceSpawn = false;
                        }
                    }
                }
            }
        }