diff --git a/CHANGELOG b/CHANGELOG index 6a9b5fc..09d73a8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,16 @@ +-- 2023.04.13 - V4.1.3 + +- feat: Option to reset killstreaks for alive players +- fix: Top command not prints properly +- fix: Points for dying not working + -- 2023.04.12 - V4.1.2 - fix: AutoPurge query +- fix: RoundStart error log (#166) +- fix: Delete invalid players on save-all +- fix: RankTop not updating instantly (#166) +- fix: RankTop position display problems (#166) -- 2023.04.11 - V4.1.1 diff --git a/K4-System/src/Module/Rank/RankCommands.cs b/K4-System/src/Module/Rank/RankCommands.cs index de1ebf3..022360a 100644 --- a/K4-System/src/Module/Rank/RankCommands.cs +++ b/K4-System/src/Module/Rank/RankCommands.cs @@ -178,28 +178,31 @@ public void OnCommandTop(CCSPlayerController? player, CommandInfo info) Task.Run(async () => { + await plugin.SaveAllPlayersDataAsync(); List<(int points, string name)>? rankData = await FetchTopDataAsync(printCount); - if (rankData?.Count > 0) + Server.NextFrame(() => { - for (int i = 0; i < rankData.Count; i++) + if (!k4player.IsValid || !k4player.IsPlayer) + return; + + if (rankData?.Count > 0) { - int points = rankData[i].points; - string name = rankData[i].name; + for (int i = 0; i < rankData.Count; i++) + { + int points = rankData[i].points; + string name = rankData[i].name; - Rank rank = GetPlayerRank(points); + Rank rank = GetPlayerRank(points); - Server.NextFrame(() => - { - player!.PrintToChat($" {plugin.Localizer["k4.ranks.top.line", i + 1, rank.Color, rank.Name, name, points]}"); - }); + k4player.Controller.PrintToChat($" {plugin.Localizer["k4.ranks.top.line", i + 1, rank.Color, rank.Name, name, points]}"); + } } - - } - else - { - player!.PrintToChat($" {plugin.Localizer["k4.general.prefix"]} {plugin.Localizer["k4.ranks.top.notfound", printCount]}"); - } + else + { + k4player.Controller.PrintToChat($" {plugin.Localizer["k4.general.prefix"]} {plugin.Localizer["k4.ranks.top.notfound", printCount]}"); + } + }); }); } diff --git a/K4-System/src/Module/Rank/RankEvents.cs b/K4-System/src/Module/Rank/RankEvents.cs index e11acab..2e62948 100644 --- a/K4-System/src/Module/Rank/RankEvents.cs +++ b/K4-System/src/Module/Rank/RankEvents.cs @@ -169,7 +169,7 @@ public void Initialize_Events() K4Player? k4attacker = plugin.GetK4Player(@event.Attacker); - if (!k4victim.IsPlayer) + if (k4victim.IsPlayer) { k4victim.KillStreak = (0, DateTime.Now); diff --git a/K4-System/src/Module/Rank/RankFunctions.cs b/K4-System/src/Module/Rank/RankFunctions.cs index bf1d3a4..c42d4c6 100644 --- a/K4-System/src/Module/Rank/RankFunctions.cs +++ b/K4-System/src/Module/Rank/RankFunctions.cs @@ -38,7 +38,7 @@ public void BeforeRoundEnd(int winnerTeam) if (!k4player.IsValid || !k4player.IsPlayer) continue; - if (!k4player.Controller.PawnIsAlive) + if (!k4player.Controller.PawnIsAlive || Config.RankSettings.KillstreakResetOnRoundEnd) k4player.KillStreak = (0, DateTime.Now); RankData? playerData = k4player.rankData; diff --git a/K4-System/src/Plugin/PluginConfig.cs b/K4-System/src/Plugin/PluginConfig.cs index 778ca57..50b69a6 100644 --- a/K4-System/src/Plugin/PluginConfig.cs +++ b/K4-System/src/Plugin/PluginConfig.cs @@ -159,6 +159,9 @@ public sealed class StatisticSettings public sealed class RankSettings { + [JsonPropertyName("killstreak-reset-on-round-end")] + public bool KillstreakResetOnRoundEnd { get; set; } = false; + [JsonPropertyName("start-points")] public int StartPoints { get; set; } = 0; diff --git a/K4-System/src/Plugin/PluginManifest.cs b/K4-System/src/Plugin/PluginManifest.cs index 75b3525..e2603b2 100644 --- a/K4-System/src/Plugin/PluginManifest.cs +++ b/K4-System/src/Plugin/PluginManifest.cs @@ -10,7 +10,7 @@ public sealed partial class Plugin : BasePlugin public override string ModuleAuthor => "K4ryuu"; - public override string ModuleVersion => "4.1.2 " + + public override string ModuleVersion => "4.1.3 " + #if RELEASE "(release)"; #else