diff --git a/Application/Server.cs b/Application/Server.cs index 486826341..1e9398962 100644 --- a/Application/Server.cs +++ b/Application/Server.cs @@ -180,6 +180,10 @@ namespace IW4MAdmin { client.CurrentAlias = existingAlias; client.CurrentAliasId = existingAlias.AliasId; + // we need to update their new ip and name to the virtual property + client.Name = polledPlayer.Name; + client.IPAddress = polledPlayer.IPAddress; + client = await Manager.GetClientService().Update(client); } diff --git a/Plugins/Stats/Cheat/Detection.cs b/Plugins/Stats/Cheat/Detection.cs index 09859251f..8eabb5376 100644 --- a/Plugins/Stats/Cheat/Detection.cs +++ b/Plugins/Stats/Cheat/Detection.cs @@ -152,7 +152,8 @@ namespace IW4MAdmin.Plugins.Stats.Cheat } // ban - if (currentStrain > Thresholds.MaxStrainBan) + if (currentStrain > Thresholds.MaxStrainBan && + HitCount > 15) { result = new DetectionPenaltyResult() { diff --git a/Plugins/Stats/Helpers/StatManager.cs b/Plugins/Stats/Helpers/StatManager.cs index 11dd1f75c..31097d4b2 100644 --- a/Plugins/Stats/Helpers/StatManager.cs +++ b/Plugins/Stats/Helpers/StatManager.cs @@ -427,7 +427,8 @@ namespace IW4MAdmin.Plugins.Stats.Helpers { using (var ctx = new DatabaseContext()) { - foreach (var change in clientDetection.Tracker.GetChanges()) + // todo: why does this cause duplicate primary key + foreach (var change in clientDetection.Tracker.GetChanges().Distinct()) { ctx.Add(change); } @@ -440,7 +441,6 @@ namespace IW4MAdmin.Plugins.Stats.Helpers case Penalty.PenaltyType.Ban: if (attacker.Level == Player.Permission.Banned) break; - await saveLog(); await attacker.Ban(Utilities.CurrentLocalization.LocalizationIndex["PLUGIN_STATS_CHEAT_DETECTED"], new Player() { ClientId = 1, @@ -454,6 +454,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers } } }); + await saveLog(); break; case Penalty.PenaltyType.Flag: if (attacker.Level != Player.Permission.User)