Add some more hack checks to painting tiles & walls
Also add permission to ignore paint threshold
This commit is contained in:
parent
149dbdf56d
commit
d4c7385781
3 changed files with 43 additions and 9 deletions
|
|
@ -1849,7 +1849,7 @@ namespace TShockAPI
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item selectedItem = args.TPlayer.inventory[args.TPlayer.selectedItem];
|
Item selectedItem = args.Player.SelectedItem;
|
||||||
if (type == 0 && !Main.tileCut[Main.tile[tileX, tileY].type] && !breakableTiles.Contains(Main.tile[tileX, tileY].type))
|
if (type == 0 && !Main.tileCut[Main.tile[tileX, tileY].type] && !breakableTiles.Contains(Main.tile[tileX, tileY].type))
|
||||||
{
|
{
|
||||||
// If the tile is an axe tile and they aren't selecting an axe, they're hacking.
|
// If the tile is an axe tile and they aren't selecting an axe, they're hacking.
|
||||||
|
|
@ -1879,7 +1879,6 @@ namespace TShockAPI
|
||||||
args.Player.SendTileSquare(tileX, tileY, 1);
|
args.Player.SendTileSquare(tileX, tileY, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (action == EditAction.PlaceTile || action == EditAction.PlaceWall)
|
else if (action == EditAction.PlaceTile || action == EditAction.PlaceWall)
|
||||||
{
|
{
|
||||||
|
|
@ -3192,6 +3191,13 @@ namespace TShockAPI
|
||||||
if (OnPaintTile(x, y, t))
|
if (OnPaintTile(x, y, t))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
// Not selecting paintbrush or paint scraper? Hacking.
|
||||||
|
if (args.Player.SelectedItem.type != 1071 && args.Player.SelectedItem.type != 1100)
|
||||||
|
{
|
||||||
|
args.Player.SendData(PacketTypes.PaintWall, "", x, y, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((DateTime.UtcNow - args.Player.LastThreat).TotalMilliseconds < 5000 ||
|
if ((DateTime.UtcNow - args.Player.LastThreat).TotalMilliseconds < 5000 ||
|
||||||
TShock.CheckTilePermission(args.Player, x, y, true) ||
|
TShock.CheckTilePermission(args.Player, x, y, true) ||
|
||||||
TShock.CheckRangePermission(args.Player, x, y))
|
TShock.CheckRangePermission(args.Player, x, y))
|
||||||
|
|
@ -3199,7 +3205,11 @@ namespace TShockAPI
|
||||||
args.Player.SendData(PacketTypes.PaintTile, "", x, y, 0);
|
args.Player.SendData(PacketTypes.PaintTile, "", x, y, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
args.Player.PaintThreshold++;
|
|
||||||
|
if (!args.Player.Group.HasPermission(Permissions.ignorepaintdetection))
|
||||||
|
{
|
||||||
|
args.Player.PaintThreshold++;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3212,6 +3222,13 @@ namespace TShockAPI
|
||||||
if (OnPaintTile(x, y, t))
|
if (OnPaintTile(x, y, t))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
// Not selecting paint roller or paint scraper? Hacking.
|
||||||
|
if (args.Player.SelectedItem.type != 1072 && args.Player.SelectedItem.type != 1100)
|
||||||
|
{
|
||||||
|
args.Player.SendData(PacketTypes.PaintWall, "", x, y, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((DateTime.UtcNow - args.Player.LastThreat).TotalMilliseconds < 5000 ||
|
if ((DateTime.UtcNow - args.Player.LastThreat).TotalMilliseconds < 5000 ||
|
||||||
TShock.CheckTilePermission(args.Player, x, y, true) ||
|
TShock.CheckTilePermission(args.Player, x, y, true) ||
|
||||||
TShock.CheckRangePermission(args.Player, x, y))
|
TShock.CheckRangePermission(args.Player, x, y))
|
||||||
|
|
@ -3219,7 +3236,11 @@ namespace TShockAPI
|
||||||
args.Player.SendData(PacketTypes.PaintWall, "", x, y, 0);
|
args.Player.SendData(PacketTypes.PaintWall, "", x, y, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
args.Player.PaintThreshold++;
|
|
||||||
|
if (!args.Player.Group.HasPermission(Permissions.ignorepaintdetection))
|
||||||
|
{
|
||||||
|
args.Player.PaintThreshold++;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,9 @@ namespace TShockAPI
|
||||||
[Description("Prevents you from being disabled by projectile abuse detection.")]
|
[Description("Prevents you from being disabled by projectile abuse detection.")]
|
||||||
public static readonly string ignoreprojectiledetection = "tshock.ignore.projectile";
|
public static readonly string ignoreprojectiledetection = "tshock.ignore.projectile";
|
||||||
|
|
||||||
|
[Description("Prevents you from being disabled by paint abuse detection.")]
|
||||||
|
public static readonly string ignorepaintdetection = "tshock.ignore.paint";
|
||||||
|
|
||||||
[Description("Prevents you from being reverted by no clip detection.")]
|
[Description("Prevents you from being reverted by no clip detection.")]
|
||||||
public static readonly string ignorenoclipdetection = "tshock.ignore.noclip";
|
public static readonly string ignorenoclipdetection = "tshock.ignore.noclip";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -319,21 +319,31 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the player's selected item.
|
||||||
|
/// </summary>
|
||||||
|
public Item SelectedItem
|
||||||
|
{
|
||||||
|
get { return TPlayer.inventory[TPlayer.selectedItem]; }
|
||||||
|
}
|
||||||
|
|
||||||
public int State
|
public int State
|
||||||
{
|
{
|
||||||
get { return Netplay.serverSock[Index].state; }
|
get { return Netplay.serverSock[Index].state; }
|
||||||
set { Netplay.serverSock[Index].state = value; }
|
set { Netplay.serverSock[Index].state = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the player's UUID.
|
||||||
|
/// </summary>
|
||||||
public string UUID
|
public string UUID
|
||||||
{
|
{
|
||||||
get {
|
get { return RealPlayer ? Netplay.serverSock[Index].clientUUID : ""; }
|
||||||
return RealPlayer
|
|
||||||
? Netplay.serverSock[Index].clientUUID
|
|
||||||
: "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the player's IP.
|
||||||
|
/// </summary>
|
||||||
public string IP
|
public string IP
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue