Replace TSPlayer.IgnoreActionsForCheating w/ boolean
This replaces IgnoreActionsForCheating in TSPlayer with a new IsDisabledForStackDetection field that tracks the same basic data. The previous way we did this was storing a string as the "reason" why a player was disabled for cheating, but it only stored the last hacked item stack that caused the check to fail. Since we already have OnSecondUpdate which notifies on _all_ items, we don't need to store this info in such a useless way anyway. They'll find out in one second what they need to remove in a more alarmist way.
This commit is contained in:
parent
1ef28dfe0d
commit
7efcfd055f
5 changed files with 10 additions and 9 deletions
|
|
@ -847,9 +847,9 @@ namespace TShockAPI
|
|||
if (distance > TShock.Config.MaxRangeForDisabled)
|
||||
{
|
||||
// We need to tell them they were disabled and why, then revert the change.
|
||||
if (args.Player.IgnoreActionsForCheating != "none")
|
||||
if (args.Player.IsDisabledForStackDetection == true)
|
||||
{
|
||||
args.Player.SendErrorMessage("Disabled for cheating: " + args.Player.IgnoreActionsForCheating);
|
||||
args.Player.SendErrorMessage("Disabled. You went too far with hacked item stacks.");
|
||||
}
|
||||
else if (args.Player.IgnoreActionsForDisabledArmor != "none")
|
||||
{
|
||||
|
|
@ -857,7 +857,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (args.Player.IsDisabledForSSC == true)
|
||||
{
|
||||
args.Player.SendErrorMessage("Disabled. Server side characters is enabled, and you aren't logged in.");
|
||||
args.Player.SendErrorMessage("Disabled. You need to {0}login, since server side characters is enabled.", TShock.Config.CommandSpecifier);
|
||||
}
|
||||
else if (TShock.Config.RequireLogin && !args.Player.IsLoggedIn)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -862,7 +862,7 @@ namespace TShockAPI
|
|||
args.Player.LoginFailsBySsi = false;
|
||||
|
||||
if (args.Player.HasPermission(Permissions.ignorestackhackdetection))
|
||||
args.Player.IgnoreActionsForCheating = "none";
|
||||
args.Player.IsDisabledForStackDetection = false;
|
||||
|
||||
if (args.Player.HasPermission(Permissions.usebanneditem))
|
||||
args.Player.IgnoreActionsForDisabledArmor = "none";
|
||||
|
|
|
|||
|
|
@ -1798,7 +1798,7 @@ namespace TShockAPI
|
|||
args.Player.LoginFailsBySsi = false;
|
||||
|
||||
if (args.Player.HasPermission(Permissions.ignorestackhackdetection))
|
||||
args.Player.IgnoreActionsForCheating = "none";
|
||||
args.Player.IsDisabledForStackDetection = false;
|
||||
|
||||
if (args.Player.HasPermission(Permissions.usebanneditem))
|
||||
args.Player.IgnoreActionsForDisabledArmor = "none";
|
||||
|
|
@ -1870,7 +1870,7 @@ namespace TShockAPI
|
|||
args.Player.LoginFailsBySsi = false;
|
||||
|
||||
if (args.Player.HasPermission(Permissions.ignorestackhackdetection))
|
||||
args.Player.IgnoreActionsForCheating = "none";
|
||||
args.Player.IsDisabledForStackDetection = false;
|
||||
|
||||
if (args.Player.HasPermission(Permissions.usebanneditem))
|
||||
args.Player.IgnoreActionsForDisabledArmor = "none";
|
||||
|
|
|
|||
|
|
@ -280,7 +280,8 @@ namespace TShockAPI
|
|||
/// <summary>Determines if the player is disabled by the SSC subsystem for not being logged in.</summary>
|
||||
public bool IsDisabledForSSC = false;
|
||||
|
||||
public string IgnoreActionsForCheating = "none";
|
||||
/// <summary>Determines if the player is disabled by Bouncer for having hacked item stacks.</summary>
|
||||
public bool IsDisabledForStackDetection = false;
|
||||
|
||||
public string IgnoreActionsForDisabledArmor = "none";
|
||||
|
||||
|
|
@ -298,7 +299,7 @@ namespace TShockAPI
|
|||
/// <returns>bool - True if any ignore is not none, false, or login state differs from the required state.</returns>
|
||||
public bool CheckIgnores()
|
||||
{
|
||||
return IsDisabledForSSC || IgnoreActionsForCheating != "none" || IgnoreActionsForDisabledArmor != "none" || IgnoreActionsForClearingTrashCan || !IsLoggedIn && TShock.Config.RequireLogin;
|
||||
return IsDisabledForSSC || IsDisabledForStackDetection || IgnoreActionsForDisabledArmor != "none" || IgnoreActionsForClearingTrashCan || !IsLoggedIn && TShock.Config.RequireLogin;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1106,7 +1106,7 @@ namespace TShockAPI
|
|||
break;
|
||||
}
|
||||
}
|
||||
player.IgnoreActionsForCheating = check;
|
||||
player.IsDisabledForStackDetection = true;
|
||||
check = "none";
|
||||
// Please don't remove this for the time being; without it, players wearing banned equipment will only get debuffed once
|
||||
foreach (Item item in player.TPlayer.armor)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue