diff --git a/StatsSystem/Events/EventHandler.cs b/StatsSystem/Events/EventHandler.cs index fc28496..7401d29 100644 --- a/StatsSystem/Events/EventHandler.cs +++ b/StatsSystem/Events/EventHandler.cs @@ -96,18 +96,18 @@ public override void OnPlayerDeath(PlayerDeathEventArgs ev) if (!Round.IsRoundStarted) return; if (ev.Player.DoNotTrack) return; LogManager.Debug($"Player {ev.Player.UserId} died. Attacker: {ev.Attacker?.UserId ?? "None"}"); - if (StatsSystemPlugin.Singleton.Config.KillsTracking) - ev.Attacker?.IncrementStat("Kills"); + if (StatsSystemPlugin.Singleton.Config.KillsTracking && ev.Attacker != null) + ev.Attacker.IncrementStat("Kills"); if (StatsSystemPlugin.Singleton.Config.DeathsTracking) ev.Player.IncrementStat("Deaths"); - if (ev.OldRole is RoleTypeId.ClassD && StatsSystemPlugin.Singleton.Config.ClassDKillsTracking) - ev.Attacker?.IncrementStat("ClassDKills"); - if (ev.Attacker?.Role is RoleTypeId.ClassD && StatsSystemPlugin.Singleton.Config.KillsAsClassDTracking) - ev.Attacker?.IncrementStat("KillsAsClassD"); - if (ev.OldRole.IsScp() && StatsSystemPlugin.Singleton.Config.ScpKillsTracking) - ev.Attacker?.IncrementStat("ScpKills"); - if (ev.DamageHandler is MicroHidDamageHandler && StatsSystemPlugin.Singleton.Config.MicroHidKillsTracking) - ev.Attacker?.IncrementStat("MicroHidKills"); + if (ev.OldRole is RoleTypeId.ClassD && StatsSystemPlugin.Singleton.Config.ClassDKillsTracking && ev.Attacker != null) + ev.Attacker.IncrementStat("ClassDKills"); + if (ev.Attacker is { Role: RoleTypeId.ClassD } && StatsSystemPlugin.Singleton.Config.KillsAsClassDTracking) + ev.Attacker.IncrementStat("KillsAsClassD"); + if (ev.OldRole.IsScp() && StatsSystemPlugin.Singleton.Config.ScpKillsTracking && ev.Attacker != null) + ev.Attacker.IncrementStat("ScpKills"); + if (ev.DamageHandler is MicroHidDamageHandler && StatsSystemPlugin.Singleton.Config.MicroHidKillsTracking && ev.Attacker != null) + ev.Attacker.IncrementStat("MicroHidKills"); base.OnPlayerDeath(ev); } diff --git a/StatsSystem/StatsSystem.csproj b/StatsSystem/StatsSystem.csproj index 8be7166..e0f85e5 100644 --- a/StatsSystem/StatsSystem.csproj +++ b/StatsSystem/StatsSystem.csproj @@ -30,6 +30,9 @@ 1591 + + 1.1.4 + 4.3.4 @@ -51,9 +54,6 @@ $(sl_references)\CommandSystem.Core.dll - - $(sl_references)\LabApi.dll - $(sl_references)\UnityEngine.CoreModule.dll diff --git a/StatsSystem/StatsSystemPlugin.cs b/StatsSystem/StatsSystemPlugin.cs index ecad4f2..17ca3a4 100644 --- a/StatsSystem/StatsSystemPlugin.cs +++ b/StatsSystem/StatsSystemPlugin.cs @@ -25,7 +25,7 @@ internal class StatsSystemPlugin : Plugin public override string Name => "StatsSystem"; public override string Description => "StatSystem"; public override string Author => "MedveMarci"; - public override Version Version { get; } = new(1, 1, 2); + public override Version Version { get; } = new(1, 1, 3); public override Version RequiredApiVersion => new(LabApiProperties.CompiledVersion); public override bool IsTransparent => true; public string githubRepo = "MedveMarci/StatsSystem";