From 11d2df1fe8bed8463e7472a4eeda1902f577b7ab Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sat, 24 Aug 2019 20:15:50 -0500 Subject: [PATCH] small stat changes --- Plugins/Stats/Helpers/StatManager.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Plugins/Stats/Helpers/StatManager.cs b/Plugins/Stats/Helpers/StatManager.cs index f27269a9e..d39cc0dfc 100644 --- a/Plugins/Stats/Helpers/StatManager.cs +++ b/Plugins/Stats/Helpers/StatManager.cs @@ -430,21 +430,21 @@ namespace IW4MAdmin.Plugins.Stats.Helpers // get individual client's stats var clientStats = playerStats[pl.ClientId]; - // remove the client from the stats dictionary as they're leaving - playerStats.TryRemove(pl.ClientId, out _); - detectionStats.TryRemove(pl.ClientId, out _); - // sync their stats before they leave clientStats = UpdateStats(clientStats); await SaveClientStats(clientStats); + // remove the client from the stats dictionary as they're leaving + playerStats.TryRemove(pl.ClientId, out _); + detectionStats.TryRemove(pl.ClientId, out _); + // increment the total play time serverStats.TotalPlayTime += pl.ConnectionLength; } private static async Task SaveClientStats(EFClientStatistics clientStats) { - using (var ctx = new DatabaseContext(disableTracking: true)) + using (var ctx = new DatabaseContext()) { ctx.Update(clientStats); await ctx.SaveChangesAsync(); @@ -533,11 +533,6 @@ namespace IW4MAdmin.Plugins.Stats.Helpers await AddStandardKill(attacker, victim); } - if (hit.IsKillstreakKill) - { - return; - } - // incase the add player event get delayed if (!_servers[serverId].PlayerStats.ContainsKey(attacker.ClientId)) { @@ -560,6 +555,11 @@ namespace IW4MAdmin.Plugins.Stats.Helpers await SaveClientStats(clientStats); } + if (hit.IsKillstreakKill) + { + return; + } + try { if (Plugin.Config.Configuration().StoreClientKills)