diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs
index 58c73228..d17f6ad9 100644
--- a/TShockAPI/ConfigFile.cs
+++ b/TShockAPI/ConfigFile.cs
@@ -277,6 +277,8 @@ namespace TShockAPI
[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;
+
///
/// Reads a configuration file from a given path
///
diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs
index 45a474b8..d7f7be18 100755
--- a/TShockAPI/GetDataHandlers.cs
+++ b/TShockAPI/GetDataHandlers.cs
@@ -3192,11 +3192,14 @@ namespace TShockAPI
if (OnPaintTile(x, y, t))
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);
return true;
}
+ args.Player.PaintThreshold++;
return false;
}
@@ -3209,11 +3212,14 @@ namespace TShockAPI
if (OnPaintTile(x, y, t))
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);
return true;
}
+ args.Player.PaintThreshold++;
return false;
}
diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index 18ad7adf..b72fa0e6 100755
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -49,10 +49,15 @@ namespace TShockAPI
public int TilePlaceThreshold { get; set; }
///
- /// 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.
///
public int TileLiquidThreshold { get; set; }
+ ///
+ /// The amount of tiles that the player has painted in the last second.
+ ///
+ public int PaintThreshold { get; set; }
+
///
/// The number of projectiles created by the player in the last second.
///
@@ -60,7 +65,7 @@ namespace TShockAPI
///
/// A timer to keep track of whether or not the player has recently thrown an explosive
- //
+ ///
public int RecentFuse = 0;
///
@@ -144,11 +149,6 @@ namespace TShockAPI
///
public DateTime LastThreat { get; set; }
- ///
- /// Not used, can be removed.
- ///
- public DateTime LastTileChangeNotify { get; set; }
-
public bool InitSpawn;
///
@@ -159,7 +159,7 @@ namespace TShockAPI
public Vector2 oldSpawn = Vector2.Zero;
///
- /// The last player that the player whispered with( to or from ).
+ /// The last player that the player whispered with (to or from).
///
public TSPlayer LastWhisper;
diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs
index 395b129c..35791b62 100755
--- a/TShockAPI/TShock.cs
+++ b/TShockAPI/TShock.cs
@@ -668,11 +668,12 @@ namespace TShockAPI
//We don't want to revert the entire map in case of a disable.
player.TilesDestroyed.Clear();
}
+
if (player.TilesCreated != null)
{
if (player.TilePlaceThreshold >= Config.TilePlaceThreshold)
{
- player.Disable("Reached TilePlace threshold.");
+ player.Disable("Reached TilePlace threshold");
TSPlayer.Server.RevertTiles(player.TilesCreated);
player.TilesCreated.Clear();
}
@@ -684,12 +685,12 @@ namespace TShockAPI
if (player.RecentFuse >0)
player.RecentFuse--;
-
+
if ((TShock.Config.ServerSideCharacter) && (player.sX > 0) && (player.sY > 0))
- {
- player.TPlayer.SpawnX=player.sX;
- player.TPlayer.SpawnY=player.sY;
- }
+ {
+ player.TPlayer.SpawnX = player.sX;
+ player.TPlayer.SpawnY = player.sY;
+ }
if (player.RPPending >0)
{
@@ -707,20 +708,31 @@ namespace TShockAPI
if (player.TileLiquidThreshold >= Config.TileLiquidThreshold)
{
- player.Disable("Reached TileLiquid threshold.");
+ player.Disable("Reached TileLiquid threshold");
}
if (player.TileLiquidThreshold > 0)
{
player.TileLiquidThreshold = 0;
}
+
if (player.ProjectileThreshold >= Config.ProjectileThreshold)
{
- player.Disable("Reached projectile threshold.");
+ player.Disable("Reached projectile threshold");
}
if (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)
{
player.Spawn();