diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs
index a506d079..a5e14115 100644
--- a/TShockAPI/Bouncer.cs
+++ b/TShockAPI/Bouncer.cs
@@ -19,18 +19,17 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Terraria.ID;
-using TShockAPI.DB;
using TShockAPI.Net;
using Terraria;
using Microsoft.Xna.Framework;
using OTAPI.Tile;
using TShockAPI.Localization;
using static TShockAPI.GetDataHandlers;
-using TerrariaApi.Server;
using Terraria.ObjectData;
using Terraria.DataStructures;
using Terraria.Localization;
using TShockAPI.Models.PlayerUpdate;
+using System.Threading.Tasks;
namespace TShockAPI
{
@@ -962,18 +961,6 @@ namespace TShockAPI
// Denotes that the player has recently set a fuse - used for cheat detection.
args.Player.RecentFuse = 10;
}
-
- if (projectileCreatesLiquid.ContainsKey(type))
- {
- lock (args.Player.RecentlyCreatedProjectiles)
- {
- args.Player.RecentlyCreatedProjectiles.Add(new ProjectileStruct()
- {
- Index = ident,
- CreatedAt = DateTime.Now
- });
- }
- }
}
/// Handles the NPC Strike event for Bouncer.
@@ -2069,6 +2056,24 @@ namespace TShockAPI
}
}
+ internal void OnSecondUpdate()
+ {
+ Task.Run(() =>
+ {
+ foreach (var player in TShock.Players)
+ {
+ if (player != null && player.TPlayer.whoAmI >= 0)
+ {
+ var threshold = DateTime.Now.AddSeconds(-5);
+ lock (player.RecentlyCreatedProjectiles)
+ {
+ player.RecentlyCreatedProjectiles = player.RecentlyCreatedProjectiles.Where(s => s.CreatedAt > threshold).ToList();
+ }
+ }
+ }
+ });
+ }
+
// These time values are references from Projectile.cs, at npc.AddBuff() calls.
private static Dictionary NPCAddBuffTimeMax = new Dictionary()
{
diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs
index 57c8985f..606f56a6 100644
--- a/TShockAPI/GetDataHandlers.cs
+++ b/TShockAPI/GetDataHandlers.cs
@@ -2322,6 +2322,18 @@ namespace TShockAPI
if (OnNewProjectile(args.Data, ident, pos, vel, knockback, dmg, owner, type, index, args.Player))
return true;
+ if (projectileCreatesLiquid.ContainsKey(type))
+ {
+ lock (args.Player.RecentlyCreatedProjectiles)
+ {
+ args.Player.RecentlyCreatedProjectiles.Add(new ProjectileStruct()
+ {
+ Index = ident,
+ CreatedAt = DateTime.Now
+ });
+ }
+ }
+
return false;
}
diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs
index 656a1314..6f685654 100644
--- a/TShockAPI/TShock.cs
+++ b/TShockAPI/TShock.cs
@@ -44,7 +44,6 @@ using Microsoft.Xna.Framework;
using TShockAPI.Sockets;
using TShockAPI.CLI;
using TShockAPI.Localization;
-using System.Threading.Tasks;
namespace TShockAPI
{
@@ -1065,19 +1064,9 @@ namespace TShockAPI
}
}
}
-
- Task.Run(() =>
- {
- if (player != null && player.TPlayer.whoAmI >= 0)
- {
- var threshold = DateTime.Now.AddSeconds(-5);
- lock (player.RecentlyCreatedProjectiles)
- {
- player.RecentlyCreatedProjectiles = player.RecentlyCreatedProjectiles.Where(s => s.CreatedAt > threshold).ToList();
- }
- }
- });
}
+
+ Bouncer.OnSecondUpdate();
Utils.SetConsoleTitle(false);
}