fix a region bypass exploit using the ice rod

This commit is contained in:
punchready 2022-07-26 08:58:56 +02:00
parent 681c6de1f7
commit 82a095f3cf

View file

@ -401,6 +401,18 @@ namespace TShockAPI
return;
}
// i do not understand the ice tile check enough to be able to modify it, however i do know that it can be used to completely bypass region protection
// this check ensures that build permission is always checked no matter what
if (!args.Player.HasBuildPermission(tileX, tileY))
{
TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from build from {0} {1} {2}", args.Player.Name, action, editData);
GetRollbackRectSize(tileX, tileY, out byte width, out byte length, out int offsetY);
args.Player.SendTileRect((short)(tileX - width), (short)(tileY + offsetY), (byte)(width * 2), (byte)(length + 1));
args.Handled = true;
return;
}
if (editData < 0 ||
((action == EditAction.PlaceTile || action == EditAction.ReplaceTile) && editData >= Main.maxTileSets) ||
((action == EditAction.PlaceWall || action == EditAction.ReplaceWall) && editData >= Main.maxWallTypes))