Skip to content

Commit

Permalink
Patch v1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
K4ryuu committed Jul 2, 2024
1 parent 375cb9b commit 62ab4f2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- feat: Added option to change the warning print interval
- feat: Added log and check for game details privated
- fix: Warning countdown issues

-- 2024. 07. 02 - v1.4.0

Expand Down
30 changes: 19 additions & 11 deletions src/KitsuneSteamRestrict.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,28 +244,36 @@ private void CheckUserViolations(nint handle, ulong authorizedSteamID)
{
if (Config.PrivateProfileWarningTime > 0 && (userInfo.IsPrivate || userInfo.IsGameDetailsPrivate))
{
g_iWarnTime[player.Slot] = Config.PrivateProfileWarningTime;
int playerSlot = player.Slot;
g_iWarnTime[playerSlot] = Config.PrivateProfileWarningTime;
int printInterval = Config.PrivateProfileWarningPrintSeconds;
int remainingPrintTime = printInterval;

AddTimer(Config.PrivateProfileWarningTime, () =>
{
if (player?.IsValid == true)
Server.ExecuteCommand($"kickid {player.UserId} \"You have been kicked for not meeting the minimum requirements.\"");
});

g_hTimer[playerSlot] = AddTimer(Config.PrivateProfileWarningPrintSeconds, () =>
g_hTimer[playerSlot] = AddTimer(1.0f, () =>
{
if (player?.IsValid == true)
{
player.PrintToChat($" {ChatColors.Silver}[ {ChatColors.Lime}SteamRestrict {ChatColors.Silver}] {ChatColors.LightRed}Your Steam profile or Game details are private. You will be kicked in {g_iWarnTime[playerSlot]} seconds.");
g_iWarnTime[playerSlot]--;
remainingPrintTime--;

if (remainingPrintTime <= 0)
{
player.PrintToChat($" {ChatColors.Silver}[ {ChatColors.Lime}SteamRestrict {ChatColors.Silver}] {ChatColors.LightRed}Your Steam profile or Game details are private. You will be kicked in {g_iWarnTime[playerSlot]} seconds.");
remainingPrintTime = printInterval;
}

if (g_iWarnTime[playerSlot] <= 0)
{
Server.ExecuteCommand($"kickid {player.UserId} \"You have been kicked for not meeting the minimum requirements.\"");
g_hTimer[playerSlot]?.Kill();
g_hTimer[playerSlot] = null;
}
}
else
{
g_hTimer[playerSlot]?.Kill();
g_hTimer[playerSlot] = null;
}

g_iWarnTime[playerSlot] -= Config.PrivateProfileWarningPrintSeconds;
}, TimerFlags.REPEAT);
}
else
Expand Down

0 comments on commit 62ab4f2

Please sign in to comment.