Merge pull request #1272 from ProfessorXZ/handletile-fix

Tile packet validation
This commit is contained in:
White 2016-09-03 21:43:59 +09:30 committed by GitHub
commit 4dca73a6cc
2 changed files with 28 additions and 16 deletions

View file

@ -21,6 +21,8 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* The Drill Containment Unit breaks blocks properly now (@ProfessorXZ)
* Fixed Expert mode coin duplication (@ProfessorXZ)
* Players are no longer able to place liquids using LoadNetModule packet (@ProfessorXZ)
* Explosives are no longer blocked by range checks (@ProfessorXZ)
* Players can no longer bypass tile checks by using the Tile packet (@ProfessorXZ)
* Fixed a bug where players couldn't hammer a Junction Box without "allowclientsideworldedit" permission (@Patrikkk)
## TShock 4.3.17

View file

@ -2030,7 +2030,6 @@ namespace TShockAPI
// If they aren't selecting a hammer, they could be hacking.
if (selectedItem.hammer == 0 && !ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0 && selectedItem.createWall == 0)
{
args.Player.SendTileSquare(tileX, tileY, 1);
return true;
}
@ -2049,6 +2048,13 @@ namespace TShockAPI
return true;
}
// If they aren't selecting the item which creates the correct tile or wall, they're hacking.
if (editData != (action == EditAction.PlaceTile ? selectedItem.createTile : selectedItem.createWall))
{
args.Player.SendTileSquare(tileX, tileY, 4);
return true;
}
// If they aren't selecting the item which creates the tile or wall, they're hacking.
if ((editData != TileID.MagicalIceBlock
&& editData != TileID.Rope
@ -2148,14 +2154,18 @@ namespace TShockAPI
return true;
}
// Ignore rope placement range
if ((editData != TileID.Rope
&& editData != TileID.SilkRope
&& editData != TileID.VineRope
&& editData != TileID.WebRope
&& action == EditAction.PlaceTile)
&& TShock.CheckRangePermission(args.Player, tileX, tileY))
if (TShock.CheckRangePermission(args.Player, tileX, tileY))
{
if (action == EditAction.PlaceTile && (editData == TileID.Rope || editData == TileID.SilkRope || editData == TileID.VineRope || editData == TileID.WebRope))
{
return false;
}
if (action == EditAction.KillTile || action == EditAction.KillWall && ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0)
{
return false;
}
args.Player.SendTileSquare(tileX, tileY, 4);
return true;
}