Add hack checks to painting tiles & walls
This commit is contained in:
parent
1b3f105bbf
commit
149dbdf56d
4 changed files with 38 additions and 18 deletions
|
|
@ -277,6 +277,8 @@ namespace TShockAPI
|
||||||
|
|
||||||
[Description("The number of seconds a player must wait before being respawned.")] public int RespawnSeconds = 3;
|
[Description("The number of seconds a player must wait before being respawned.")] public int RespawnSeconds = 3;
|
||||||
|
|
||||||
|
[Description("Disables a player if this number of tiles is painted within 1 second.")] public int TilePaintThreshold = 10;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads a configuration file from a given path
|
/// Reads a configuration file from a given path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -3192,11 +3192,14 @@ namespace TShockAPI
|
||||||
if (OnPaintTile(x, y, t))
|
if (OnPaintTile(x, y, t))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (TShock.CheckTilePermission(args.Player, x, y, true))
|
if ((DateTime.UtcNow - args.Player.LastThreat).TotalMilliseconds < 5000 ||
|
||||||
|
TShock.CheckTilePermission(args.Player, x, y, true) ||
|
||||||
|
TShock.CheckRangePermission(args.Player, x, y))
|
||||||
{
|
{
|
||||||
args.Player.SendData(PacketTypes.PaintTile, "", x, y, 0);
|
args.Player.SendData(PacketTypes.PaintTile, "", x, y, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
args.Player.PaintThreshold++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3209,11 +3212,14 @@ namespace TShockAPI
|
||||||
if (OnPaintTile(x, y, t))
|
if (OnPaintTile(x, y, t))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (TShock.CheckTilePermission(args.Player, x, y, true))
|
if ((DateTime.UtcNow - args.Player.LastThreat).TotalMilliseconds < 5000 ||
|
||||||
|
TShock.CheckTilePermission(args.Player, x, y, true) ||
|
||||||
|
TShock.CheckRangePermission(args.Player, x, y))
|
||||||
{
|
{
|
||||||
args.Player.SendData(PacketTypes.PaintWall, "", x, y, 0);
|
args.Player.SendData(PacketTypes.PaintWall, "", x, y, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
args.Player.PaintThreshold++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,15 @@ namespace TShockAPI
|
||||||
public int TilePlaceThreshold { get; set; }
|
public int TilePlaceThreshold { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of liquid( in tiles ) that the player has placed in the last second.
|
/// The amount of liquid (in tiles) that the player has placed in the last second.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TileLiquidThreshold { get; set; }
|
public int TileLiquidThreshold { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The amount of tiles that the player has painted in the last second.
|
||||||
|
/// </summary>
|
||||||
|
public int PaintThreshold { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of projectiles created by the player in the last second.
|
/// The number of projectiles created by the player in the last second.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -60,7 +65,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A timer to keep track of whether or not the player has recently thrown an explosive
|
/// A timer to keep track of whether or not the player has recently thrown an explosive
|
||||||
// </summary>
|
/// </summary>
|
||||||
public int RecentFuse = 0;
|
public int RecentFuse = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -144,11 +149,6 @@ namespace TShockAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime LastThreat { get; set; }
|
public DateTime LastThreat { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Not used, can be removed.
|
|
||||||
/// </summary>
|
|
||||||
public DateTime LastTileChangeNotify { get; set; }
|
|
||||||
|
|
||||||
public bool InitSpawn;
|
public bool InitSpawn;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -159,7 +159,7 @@ namespace TShockAPI
|
||||||
public Vector2 oldSpawn = Vector2.Zero;
|
public Vector2 oldSpawn = Vector2.Zero;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The last player that the player whispered with( to or from ).
|
/// The last player that the player whispered with (to or from).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TSPlayer LastWhisper;
|
public TSPlayer LastWhisper;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -668,11 +668,12 @@ namespace TShockAPI
|
||||||
//We don't want to revert the entire map in case of a disable.
|
//We don't want to revert the entire map in case of a disable.
|
||||||
player.TilesDestroyed.Clear();
|
player.TilesDestroyed.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.TilesCreated != null)
|
if (player.TilesCreated != null)
|
||||||
{
|
{
|
||||||
if (player.TilePlaceThreshold >= Config.TilePlaceThreshold)
|
if (player.TilePlaceThreshold >= Config.TilePlaceThreshold)
|
||||||
{
|
{
|
||||||
player.Disable("Reached TilePlace threshold.");
|
player.Disable("Reached TilePlace threshold");
|
||||||
TSPlayer.Server.RevertTiles(player.TilesCreated);
|
TSPlayer.Server.RevertTiles(player.TilesCreated);
|
||||||
player.TilesCreated.Clear();
|
player.TilesCreated.Clear();
|
||||||
}
|
}
|
||||||
|
|
@ -684,12 +685,12 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (player.RecentFuse >0)
|
if (player.RecentFuse >0)
|
||||||
player.RecentFuse--;
|
player.RecentFuse--;
|
||||||
|
|
||||||
if ((TShock.Config.ServerSideCharacter) && (player.sX > 0) && (player.sY > 0))
|
if ((TShock.Config.ServerSideCharacter) && (player.sX > 0) && (player.sY > 0))
|
||||||
{
|
{
|
||||||
player.TPlayer.SpawnX=player.sX;
|
player.TPlayer.SpawnX = player.sX;
|
||||||
player.TPlayer.SpawnY=player.sY;
|
player.TPlayer.SpawnY = player.sY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.RPPending >0)
|
if (player.RPPending >0)
|
||||||
{
|
{
|
||||||
|
|
@ -707,20 +708,31 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (player.TileLiquidThreshold >= Config.TileLiquidThreshold)
|
if (player.TileLiquidThreshold >= Config.TileLiquidThreshold)
|
||||||
{
|
{
|
||||||
player.Disable("Reached TileLiquid threshold.");
|
player.Disable("Reached TileLiquid threshold");
|
||||||
}
|
}
|
||||||
if (player.TileLiquidThreshold > 0)
|
if (player.TileLiquidThreshold > 0)
|
||||||
{
|
{
|
||||||
player.TileLiquidThreshold = 0;
|
player.TileLiquidThreshold = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.ProjectileThreshold >= Config.ProjectileThreshold)
|
if (player.ProjectileThreshold >= Config.ProjectileThreshold)
|
||||||
{
|
{
|
||||||
player.Disable("Reached projectile threshold.");
|
player.Disable("Reached projectile threshold");
|
||||||
}
|
}
|
||||||
if (player.ProjectileThreshold > 0)
|
if (player.ProjectileThreshold > 0)
|
||||||
{
|
{
|
||||||
player.ProjectileThreshold = 0;
|
player.ProjectileThreshold = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player.PaintThreshold >= Config.TilePaintThreshold)
|
||||||
|
{
|
||||||
|
player.Disable("Reached paint threshold");
|
||||||
|
}
|
||||||
|
if (player.PaintThreshold > 0)
|
||||||
|
{
|
||||||
|
player.PaintThreshold = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (player.Dead && (DateTime.Now - player.LastDeath).Seconds >= Config.RespawnSeconds && player.Difficulty != 2)
|
if (player.Dead && (DateTime.Now - player.LastDeath).Seconds >= Config.RespawnSeconds && player.Difficulty != 2)
|
||||||
{
|
{
|
||||||
player.Spawn();
|
player.Spawn();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue