Merge pull request #1996 from moisterrific/patch-14

Add config defined threshold kicks to Bouncer
This commit is contained in:
Chris 2020-06-07 12:47:13 +09:30 committed by GitHub
commit 5f03f68a6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -494,20 +494,36 @@ namespace TShockAPI
if (args.Player.TileKillThreshold >= TShock.Config.TileKillThreshold)
{
if (TShock.Config.KickOnTileKillThresholdBroken)
{
args.Player.Kick(string.Format("Tile kill threshold exceeded {0}.", TShock.Config.TileKillThreshold));
}
else
{
args.Player.Disable("Reached TileKill threshold.", DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquare(tileX, tileY, 4);
}
TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from tile kill threshold from {0}, (value: {1})", args.Player.Name, args.Player.TileKillThreshold);
TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the damage value they were disabled for to TShock so we can improve this!");
args.Player.Disable("Reached TileKill threshold.", DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquare(tileX, tileY, 4);
TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the tile kill threshold they were disabled for to TShock so we can improve this!");
args.Handled = true;
return;
}
if (args.Player.TilePlaceThreshold >= TShock.Config.TilePlaceThreshold)
{
if (TShock.Config.KickOnTilePlaceThresholdBroken)
{
args.Player.Kick(string.Format("Tile place threshold exceeded {0}.", TShock.Config.TilePlaceThreshold));
}
else
{
args.Player.Disable("Reached TilePlace threshold.", DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquare(tileX, tileY, 4);
}
TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from tile place threshold from {0}, (value: {1})", args.Player.Name, args.Player.TilePlaceThreshold);
TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the damage value they were disabled for to TShock so we can improve this!");
args.Player.Disable("Reached TilePlace threshold.", DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquare(tileX, tileY, 4);
TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the tile place threshold they were disabled for to TShock so we can improve this!");
args.Handled = true;
return;
}
@ -761,9 +777,18 @@ namespace TShockAPI
if (args.Player.ProjectileThreshold >= TShock.Config.ProjectileThreshold)
{
args.Player.Disable("Reached projectile update threshold.", DisableFlags.WriteToLogAndConsole);
TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from proj update threshold from {0} {1}/{2}", args.Player.Name, args.Player.ProjectileThreshold, TShock.Config.ProjectileThreshold);
args.Player.RemoveProjectile(ident, owner);
if (TShock.Config.KickOnProjectileThresholdBroken)
{
args.Player.Kick(string.Format("Projectile update threshold exceeded {0}.", TShock.Config.ProjectileThreshold));
}
else
{
args.Player.Disable("Reached projectile update threshold.", DisableFlags.WriteToLogAndConsole);
args.Player.RemoveProjectile(ident, owner);
}
TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from projectile update threshold from {0} {1}/{2}", args.Player.Name, args.Player.ProjectileThreshold, TShock.Config.ProjectileThreshold);
TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the projectile update threshold they were disabled for to TShock so we can improve this!");
args.Handled = true;
return;
}
@ -817,21 +842,20 @@ namespace TShockAPI
return;
}
if (damage > TShock.Config.MaxDamage && !args.Player.HasPermission(Permissions.ignoredamagecap))
if (damage >= TShock.Config.MaxDamage && !args.Player.HasPermission(Permissions.ignoredamagecap))
{
if (TShock.Config.KickOnDamageThresholdBroken)
{
args.Player.Kick(string.Format("NPC damage exceeded {0}.", TShock.Config.MaxDamage));
TShock.Log.ConsoleDebug("Bouncer / OnNPCStrike rejected from kodtb from {0} {1}/{2}", args.Player.Name, damage, TShock.Config.MaxDamage);
args.Handled = true;
return;
}
else
{
TShock.Log.ConsoleDebug("Bouncer / OnNPCStrike rejected from dtb from {0} {1}/{2}", args.Player.Name, damage, TShock.Config.MaxDamage);
args.Player.Disable(String.Format("NPC damage exceeded {0}.", TShock.Config.MaxDamage), DisableFlags.WriteToLogAndConsole);
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
}
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
TShock.Log.ConsoleDebug("Bouncer / OnNPCStrike rejected from damage threshold from {0} {1}/{2}", args.Player.Name, damage, TShock.Config.MaxDamage);
TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the damage threshold they were disabled for to TShock so we can improve this!");
args.Handled = true;
return;
}
@ -1114,9 +1138,18 @@ namespace TShockAPI
if (args.Player.TileLiquidThreshold >= TShock.Config.TileLiquidThreshold)
{
if (TShock.Config.KickOnTileLiquidThresholdBroken)
{
args.Player.Kick(string.Format("Reached TileLiquid threshold {0}.", TShock.Config.TileLiquidThreshold));
}
else
{
args.Player.Disable("Reached TileLiquid threshold.", DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquare(tileX, tileY, 1);
}
TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected from liquid threshold from {0} {1}/{2}", args.Player.Name, args.Player.TileLiquidThreshold, TShock.Config.TileLiquidThreshold);
args.Player.Disable("Reached TileLiquid threshold.", DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquare(tileX, tileY, 1);
TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the tile liquid threshold they were disabled for to TShock so we can improve this!");
args.Handled = true;
return;
}
@ -1440,25 +1473,33 @@ namespace TShockAPI
// Why 0.2?
// @bartico6: Because heal other player only happens when you are using the spectre armor with the hood,
// and the healing you can do with that is 20% of your damage.
if (amount > TShock.Config.MaxDamage * 0.2)
if (amount >= TShock.Config.MaxDamage * 0.2)
{
TShock.Log.ConsoleDebug("Bouncer / OnUpdateNPCHome 0.2 check from {0}", args.Player.Name);
TShock.Log.ConsoleDebug("Bouncer / OnHealOtherPlayer 0.2 check from {0}", args.Player.Name);
args.Player.Disable("HealOtherPlayer cheat attempt!", DisableFlags.WriteToLogAndConsole);
args.Handled = true;
return;
}
if (args.Player.HealOtherThreshold > TShock.Config.HealOtherThreshold)
if (args.Player.HealOtherThreshold >= TShock.Config.HealOtherThreshold)
{
TShock.Log.ConsoleDebug("Bouncer / OnUpdateNPCHome rejected heal other threshold from {0} {1}/{2}", args.Player.Name, args.Player.HealOtherThreshold, TShock.Config.HealOtherThreshold);
args.Player.Disable("Reached HealOtherPlayer threshold.", DisableFlags.WriteToLogAndConsole);
if (TShock.Config.KickOnHealOtherThresholdBroken)
{
args.Player.Kick(string.Format("HealOtherPlayer threshold exceeded {0}.", TShock.Config.HealOtherThreshold));
}
else
{
args.Player.Disable("Reached HealOtherPlayer threshold.", DisableFlags.WriteToLogAndConsole);
}
TShock.Log.ConsoleDebug("Bouncer / OnHealOtherPlayer rejected heal other threshold from {0} {1}/{2}", args.Player.Name, args.Player.HealOtherThreshold, TShock.Config.HealOtherThreshold);
TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the HealOtherPlayer threshold they were disabled for to TShock so we can improve this!");
args.Handled = true;
return;
}
if (args.Player.IsBeingDisabled() || args.Player.IsBouncerThrottled())
{
TShock.Log.ConsoleDebug("Bouncer / OnUpdateNPCHome rejected disabled/throttled from {0}", args.Player.Name);
TShock.Log.ConsoleDebug("Bouncer / OnHealOtherPlayer rejected disabled/throttled from {0}", args.Player.Name);
args.Handled = true;
return;
}