diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 6628a67b2..ffe718149 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -3056,20 +3056,17 @@ internal void OnQuickStack(object sender, OTAPI.Hooks.Chest.QuickStackEventArgs internal void OnSecondUpdate() { - Task.Run(() => + var threshold = DateTime.UtcNow.AddSeconds(-5); + foreach (var player in TShock.Players) { - foreach (var player in TShock.Players) + if (player != null && player.TPlayer.whoAmI >= 0) { - if (player != null && player.TPlayer.whoAmI >= 0) + lock (player.RecentlyCreatedProjectiles) { - var threshold = DateTime.Now.AddSeconds(-5); - lock (player.RecentlyCreatedProjectiles) - { - player.RecentlyCreatedProjectiles = player.RecentlyCreatedProjectiles.Where(s => s.CreatedAt > threshold).ToList(); - } + player.RecentlyCreatedProjectiles.RemoveAll(s => s.CreatedAt <= threshold); } } - }); + } } ///