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

Commit 375cb9b

Browse files
committed
Patch v1.4.1
1 parent 3dc88a2 commit 375cb9b

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
-- 2024. 07. 02 - v1.4.1
2+
3+
- feat: Added option to change the warning print interval
4+
- feat: Added log and check for game details privated
5+
16
-- 2024. 07. 02 - v1.4.0
27

38
- feat: Added option to allow private profiles join for given seconds to warn them about the issue

src/KitsuneSteamRestrict.cs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ public class PluginConfig : BasePluginConfig
4949
public bool BlockGameBanned { get; set; } = false;
5050

5151
[JsonPropertyName("PrivateProfileWarningTime")]
52-
public int PrivateProfileWarningTime { get; set; } = 5;
52+
public int PrivateProfileWarningTime { get; set; } = 20;
53+
54+
[JsonPropertyName("PrivateProfileWarningPrintSeconds")]
55+
public int PrivateProfileWarningPrintSeconds { get; set; } = 3;
5356

5457
[JsonPropertyName("DatabaseSettings")]
5558
public DatabaseSettings DatabaseSettings { get; set; } = new DatabaseSettings();
@@ -89,7 +92,7 @@ public sealed class DatabaseSettings
8992
public class SteamRestrictPlugin : BasePlugin, IPluginConfig<PluginConfig>
9093
{
9194
public override string ModuleName => "Steam Restrict";
92-
public override string ModuleVersion => "1.4.0";
95+
public override string ModuleVersion => "1.4.1";
9396
public override string ModuleAuthor => "K4ryuu, Cruze @ KitsuneLab";
9497
public override string ModuleDescription => "Restrict certain players from connecting to your server.";
9598

@@ -231,35 +234,38 @@ private void CheckUserViolations(nint handle, ulong authorizedSteamID)
231234
Logger.LogInformation($"Steam Account Creation Date: N/A");
232235
//Logger.LogInformation($"HasPrime: {userInfo.HasPrime}"); Removed due to people bought prime after CS2 cannot be detected sadly (or atleast not yet)
233236
Logger.LogInformation($"HasPrivateProfile: {userInfo.IsPrivate}");
237+
Logger.LogInformation($"HasPrivateGameDetails: {userInfo.IsGameDetailsPrivate}");
234238
Logger.LogInformation($"IsTradeBanned: {userInfo.IsTradeBanned}");
235239
Logger.LogInformation($"IsGameBanned: {userInfo.IsGameBanned}");
236240
Logger.LogInformation($"IsInSteamGroup: {userInfo.IsInSteamGroup}");
237241
}
238242

239243
if (IsRestrictionViolated(player, userInfo))
240244
{
241-
if (Config.PrivateProfileWarningTime > 0 && userInfo.IsPrivate)
245+
if (Config.PrivateProfileWarningTime > 0 && (userInfo.IsPrivate || userInfo.IsGameDetailsPrivate))
242246
{
243247
g_iWarnTime[player.Slot] = Config.PrivateProfileWarningTime;
244248
int playerSlot = player.Slot;
245249

246-
g_hTimer[playerSlot] = AddTimer(1, () =>
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, () =>
247257
{
248258
if (player?.IsValid == true)
249259
{
250260
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.");
251261
}
252-
253-
g_iWarnTime[playerSlot]--;
254-
255-
if (g_iWarnTime[playerSlot] <= 0)
262+
else
256263
{
257-
if (player?.IsValid == true)
258-
Server.ExecuteCommand($"kickid {player.UserId} \"You have been kicked for not meeting the minimum requirements.\"");
259-
260264
g_hTimer[playerSlot]?.Kill();
261265
g_hTimer[playerSlot] = null;
262266
}
267+
268+
g_iWarnTime[playerSlot] -= Config.PrivateProfileWarningPrintSeconds;
263269
}, TimerFlags.REPEAT);
264270
}
265271
else
@@ -300,7 +306,7 @@ private bool IsRestrictionViolated(CCSPlayerController player, SteamUserInfo use
300306
if (!(playerBypassConfig?.BypassMinimumSteamAccountAge ?? false) && Config.MinimumSteamAccountAgeInDays != -1 && (DateTime.Now - userInfo.SteamAccountAge).TotalDays < Config.MinimumSteamAccountAgeInDays)
301307
return true;
302308

303-
if (Config.BlockPrivateProfile && !(playerBypassConfig?.BypassPrivateProfile ?? false) && userInfo.IsPrivate)
309+
if (Config.BlockPrivateProfile && !(playerBypassConfig?.BypassPrivateProfile ?? false) && (userInfo.IsPrivate || userInfo.IsGameDetailsPrivate))
304310
return true;
305311

306312
if (Config.BlockTradeBanned && !(playerBypassConfig?.BypassTradeBanned ?? false) && userInfo.IsTradeBanned)

src/Models/SteamService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class SteamUserInfo
1010
public int CS2Level { get; set; }
1111
public int CS2Playtime { get; set; }
1212
public bool IsPrivate { get; set; }
13+
public bool IsGameDetailsPrivate { get; set; }
1314
public bool HasPrime { get; set; }
1415
public bool IsTradeBanned { get; set; }
1516
public bool IsVACBanned { get; set; }
@@ -145,6 +146,7 @@ private void ParseSteamUserInfo(string json, SteamUserInfo userInfo)
145146
if (player != null)
146147
{
147148
userInfo.IsPrivate = player["communityvisibilitystate"]?.ToObject<int?>() != 3;
149+
userInfo.IsGameDetailsPrivate = player["gameextrainfo"] == null;
148150
int? timeCreated = player["timecreated"]?.ToObject<int?>();
149151
userInfo.SteamAccountAge = timeCreated.HasValue
150152
? new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(timeCreated.Value)

0 commit comments

Comments
 (0)