Merge pull request #1465 from ProfessorXZ/validateplaceobject

Validate tile placement on PlaceObject, update CHANGELOG.md. Fixes #1418
This commit is contained in:
Hussein Farran 2017-07-18 13:35:36 -04:00 committed by GitHub
commit 8b18de5a2a
2 changed files with 15 additions and 0 deletions

View file

@ -3,7 +3,13 @@
This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large.
## Upcoming Changes
* API: Added hooks for item, projectile and tile bans (@deadsurgeon42)
* API: New WorldGrassSpread hook which shold allow corruption/crimson/hallow creep config options to work (@DeathCradle)
* Fixed saving when one player is one the server and another one joins (@MarioE)
* Fixed /spawnmob not spawning negative IDs (@MarioE)
* Validated tile placement on PlaceObject; clients can no longer place frames, paintings etc with dirt blocks (@bartico6, @ProfessorXZ)
## TShock 4.3.24
* API: Changed `PlayerHooks` permission hook mechanisms to allow negation from hooks (@deadsurgeon42)
* Updated OpenTerraria API to 1.3.5.3 (@DeathCradle)
* Updated Terraria Server API to 1.3.5.3 (@WhiteXZ, @hakusaro)

View file

@ -2350,6 +2350,15 @@ namespace TShockAPI
return true;
}
// This is neccessary to check in order to prevent special tiles such as
// queen bee larva, paintings etc that use this packet from being placed
// without selecting the right item.
if (type != args.TPlayer.inventory[args.TPlayer.selectedItem].createTile)
{
args.Player.SendTileSquare(x, y, 4);
return true;
}
TileObjectData tileData = TileObjectData.GetTileData(type, style, 0);
if (tileData == null)
return true;