Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Patch v4.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
K4ryuu committed Apr 16, 2024
1 parent 6153236 commit 61afb68
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-- 2023.04.16 - V4.1.6

- fix: Stats/Points not counted for bots even if they are enabled
- fix: Hotreload MySQL problems when loading all players
- fix: Compatibility issues with Multi Addon Manager
- fix: Bots being processed by MySQL join check
- fix: HTLV processed to K4Players
- fix: SaveAllPlayers blocked by bots

-- 2023.04.16 - V4.1.5

- fix: Clantag set if its empty or disabled
Expand Down
15 changes: 9 additions & 6 deletions K4-System/src/Plugin/PluginBasics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ public void Initialize_Commands()

public void Initialize_Events()
{
RegisterEventHandler((EventPlayerConnectFull @event, GameEventInfo info) =>
RegisterEventHandler((EventPlayerActivate @event, GameEventInfo info) =>
{
CCSPlayerController player = @event.Userid;
if (player is null || !player.IsValid || !player.PlayerPawn.IsValid)
if (player is null || !player.IsValid || !player.PlayerPawn.IsValid || player.IsHLTV)
return HookResult.Continue;
// Do not load the data, if the user is in the cache already
Expand All @@ -104,6 +104,12 @@ public void Initialize_Events()
K4Player k4player = new K4Player(this, player);
if (player.IsBot)
{
K4Players.Add(k4player);
return HookResult.Continue;
}
Task.Run(() => LoadPlayerCacheAsync(k4player));
return HookResult.Continue;
});
Expand Down Expand Up @@ -140,14 +146,11 @@ public void Initialize_Events()
lastRoundStartEventTime = DateTime.Now;
foreach (K4Player k4Player in K4Players)
foreach (K4Player k4Player in K4Players.ToList())
{
if (!k4Player.IsValid || !k4Player.IsPlayer)
continue;
if (k4Player.Controller.IsBot || k4Player.Controller.IsHLTV)
continue;
k4Player.Controller.PrintToChat($" {Localizer["k4.general.prefix"]} {ChatColors.Lime}{Localizer["k4.general.spawnmessage"]}");
}
Expand Down
10 changes: 6 additions & 4 deletions K4-System/src/Plugin/PluginDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public async Task PurgeTableRowsAsync()
}
catch (Exception ex)
{
Server.NextFrame(() => Logger.LogError("An error occurred while saving all players data: {ErrorMessage}", ex.Message));
Server.NextFrame(() => Logger.LogError("An error occurred while purging unused data: {ErrorMessage}", ex.Message));
}
}

Expand All @@ -79,8 +79,10 @@ public async Task SaveAllPlayersDataAsync()
{
try
{
foreach (K4Player k4player in K4Players)
foreach (K4Player k4player in K4Players.ToList())
{
if (!k4player.IsValid || !k4player.IsPlayer)
continue;

if (k4player.rankData != null)
await ExecuteRankUpdateAsync(transaction, k4player);
Expand Down Expand Up @@ -455,14 +457,14 @@ public async Task LoadAllPlayersCacheAsync(string combinedQuery)
{
using (var connection = CreateConnection(Config))
{
await connection.OpenAsync();
var players = await connection.QueryAsync<dynamic>(combinedQuery);

foreach (var k4player in K4Players)
foreach (var k4player in K4Players.ToList())
{
if (!k4player.IsValid || !k4player.IsPlayer)
continue;

await connection.OpenAsync();
var rows = await connection.QueryAsync(combinedQuery);

foreach (var row in rows)
Expand Down
2 changes: 1 addition & 1 deletion K4-System/src/Plugin/PluginManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public sealed partial class Plugin : BasePlugin

public override string ModuleAuthor => "K4ryuu";

public override string ModuleVersion => "4.1.5 " +
public override string ModuleVersion => "4.1.6 " +
#if RELEASE
"(release)";
#else
Expand Down

0 comments on commit 61afb68

Please sign in to comment.