Skip to content

Commit

Permalink
Fixed a bug, where it would not respect disabled check for VAC
Browse files Browse the repository at this point in the history
also included dayssincelastban
  • Loading branch information
Sapd committed Jan 24, 2021
1 parent 9ada4f0 commit 8529128
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Default configuration:
"LogInsteadofKick": false,
"Thresholds": {
"MaxVACBans": 1,
"MinDaysSinceLastBan": -1,
"MaxGameBans": 1,
"MinSteamLevel": 2,
"MaxAccountCreationTime": -1,
Expand Down Expand Up @@ -67,6 +68,8 @@ Default configuration:
* With this option being false, it will only do the hour-checks if he has the hours-played-information on public (recommended)
* `LogInsteadofKick` (`true` or `false`) -- If true, will just log whether the player would pass the steamchecks, instead of actually kicking him on failure
* `MaxVACBans` -- If `0`, will kick if the user has any VAC Ban. If `1`, will kick if the user has at least 2 VAC Bans, etc.. Use `-1` to disable check.
* `MinDaysSinceLastBan` -- Minimum Number of days since the last ban. Use `-1` to disable check.
* This option only makes sense, when `MaxVACBans` is greater than 0 or disabled with -1.
* `MaxGameBans` -- If `0`, will kick if the user has any Game Ban. If `1`, will kick if the user has at least 2 Game Bans, etc.. Use `-1` to disable check.

###### Those options require a **public** steam profile:
Expand Down Expand Up @@ -112,7 +115,7 @@ The checks are completly asynchronous.
## Issues

If you encounter a bug, please create an GitHub issue.
Please include the output of `steamcheck <steamid64>` and `steamcheck.runtests <steamid64>`, using the steamid on which the checks don't pass correctly. Also your configuration file would be helpful.
Please include the output of `steamcheck <steamid64>` and `steamcheck.runtests <steamid64>`, using the steamid on which the checks don't pass correctly. If you have an error, also include the offending steamids. Also your configuration file would be helpful.

## Development

Expand Down
18 changes: 14 additions & 4 deletions SteamChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ public class SteamChecks : CovalencePlugin
/// </summary>
private int maxVACBans;
/// <summary>
/// How old the last VAC ban should minimally
/// </summary>
private int minDaysSinceLastBan;
/// <summary>
/// Maximum amount of game bans, the user is allowed to have
/// </summary>
private int maxGameBans;
Expand Down Expand Up @@ -155,6 +159,7 @@ protected override void LoadDefaultConfig()
Config["Thresholds"] = new Dictionary<string, long>
{
["MaxVACBans"] = 1,
["MinDaysSinceLastBan"] = -1,
["MaxGameBans"] = 1,
["MinSteamLevel"] = 2,
["MaxAccountCreationTime"] = -1,
Expand Down Expand Up @@ -185,6 +190,7 @@ private void InitializeConfig()
forceHoursPlayedKick = Config.Get<bool>("Kicking", "ForceHoursPlayedKick");

maxVACBans = Config.Get<int>("Thresholds", "MaxVACBans");
minDaysSinceLastBan = Config.Get<int>("Thresholds", "MinDaysSinceLastBan");
maxGameBans = Config.Get<int>("Thresholds", "MaxGameBans");


Expand Down Expand Up @@ -373,14 +379,18 @@ private void CheckPlayer(string steamid, Action<bool, string> callback)
callback(false, Lang("KickTradeBan"));
return;
}
if (banResponse.GameBanCount > maxGameBans)
if (banResponse.GameBanCount > maxGameBans && maxGameBans > -1)
{
callback(false, Lang("KickGameBan"));
return;
}
// The Steam API returns two values, one is the count of VAC bans and one a boolean
// We will check both to be sure
if (banResponse.VacBanCount > maxVACBans || (banResponse.VacBan && maxVACBans == 0))

if (banResponse.VacBanCount > maxVACBans && maxVACBans > -1)
{
callback(false, Lang("KickVacBan"));
return;
}
if (banResponse.LastBan < minDaysSinceLastBan && minDaysSinceLastBan > 0)
{
callback(false, Lang("KickVacBan"));
return;
Expand Down

0 comments on commit 8529128

Please sign in to comment.