Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 62ab4f2

Browse files
committed
Patch v1.4.1
1 parent 375cb9b commit 62ab4f2

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

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

67
-- 2024. 07. 02 - v1.4.0
78

src/KitsuneSteamRestrict.cs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -244,28 +244,36 @@ private void CheckUserViolations(nint handle, ulong authorizedSteamID)
244244
{
245245
if (Config.PrivateProfileWarningTime > 0 && (userInfo.IsPrivate || userInfo.IsGameDetailsPrivate))
246246
{
247-
g_iWarnTime[player.Slot] = Config.PrivateProfileWarningTime;
248247
int playerSlot = player.Slot;
248+
g_iWarnTime[playerSlot] = Config.PrivateProfileWarningTime;
249+
int printInterval = Config.PrivateProfileWarningPrintSeconds;
250+
int remainingPrintTime = printInterval;
249251

250-
AddTimer(Config.PrivateProfileWarningTime, () =>
251-
{
252-
if (player?.IsValid == true)
253-
Server.ExecuteCommand($"kickid {player.UserId} \"You have been kicked for not meeting the minimum requirements.\"");
254-
});
255-
256-
g_hTimer[playerSlot] = AddTimer(Config.PrivateProfileWarningPrintSeconds, () =>
252+
g_hTimer[playerSlot] = AddTimer(1.0f, () =>
257253
{
258254
if (player?.IsValid == true)
259255
{
260-
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.");
256+
g_iWarnTime[playerSlot]--;
257+
remainingPrintTime--;
258+
259+
if (remainingPrintTime <= 0)
260+
{
261+
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.");
262+
remainingPrintTime = printInterval;
263+
}
264+
265+
if (g_iWarnTime[playerSlot] <= 0)
266+
{
267+
Server.ExecuteCommand($"kickid {player.UserId} \"You have been kicked for not meeting the minimum requirements.\"");
268+
g_hTimer[playerSlot]?.Kill();
269+
g_hTimer[playerSlot] = null;
270+
}
261271
}
262272
else
263273
{
264274
g_hTimer[playerSlot]?.Kill();
265275
g_hTimer[playerSlot] = null;
266276
}
267-
268-
g_iWarnTime[playerSlot] -= Config.PrivateProfileWarningPrintSeconds;
269277
}, TimerFlags.REPEAT);
270278
}
271279
else

0 commit comments

Comments
 (0)