Fix the last sendtilesquare exploit, I hope.

This commit is contained in:
MarioE 2013-10-23 18:08:21 -04:00
parent 16093fd9ca
commit 61b8885ba0
2 changed files with 298 additions and 288 deletions

View file

@ -628,8 +628,7 @@ namespace TShockAPI.DB
return true; return true;
} }
return AllowedIDs.Contains(ply.UserID) || AllowedGroups.Contains(ply.Group.Name) || Owner == ply.UserAccountName || return AllowedIDs.Contains(ply.UserID) || AllowedGroups.Contains(ply.Group.Name) || Owner == ply.UserAccountName;
ply.Group.HasPermission("manageregion");
} }
public void setAllowedIDs(String ids) public void setAllowedIDs(String ids)

View file

@ -1249,6 +1249,7 @@ namespace TShockAPI
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); Log.Error(ex.ToString());
return true;
} }
} }
return false; return false;
@ -1629,12 +1630,13 @@ namespace TShockAPI
if (TShock.CheckIgnores(args.Player)) if (TShock.CheckIgnores(args.Player))
{ {
args.Player.SendTileSquare(tileX, tileY); args.Player.SendTileSquare(tileX, tileY, size);
return true; return true;
} }
try
{
var tiles = new NetTile[size, size]; var tiles = new NetTile[size, size];
for (int x = 0; x < size; x++) for (int x = 0; x < size; x++)
{ {
for (int y = 0; y < size; y++) for (int y = 0; y < size; y++)
@ -1658,12 +1660,8 @@ namespace TShockAPI
var tile = Main.tile[realx, realy]; var tile = Main.tile[realx, realy];
var newtile = tiles[x, y]; var newtile = tiles[x, y];
if (TShock.CheckTilePermission(args.Player, realx, realy)) if (TShock.CheckTilePermission(args.Player, realx, realy) ||
{ TShock.CheckRangePermission(args.Player, realx, realy))
continue;
}
// Server now has a range check built in
if (TShock.CheckRangePermission(args.Player, realx, realy))
{ {
continue; continue;
} }
@ -1720,6 +1718,11 @@ namespace TShockAPI
{ {
args.Player.SendTileSquare(tileX, tileY, size); args.Player.SendTileSquare(tileX, tileY, size);
} }
}
catch
{
args.Player.SendTileSquare(tileX, tileY, size);
}
return true; return true;
} }
@ -1751,6 +1754,9 @@ namespace TShockAPI
EditAction action = (EditAction)args.Data.ReadInt8(); EditAction action = (EditAction)args.Data.ReadInt8();
var tileX = args.Data.ReadInt32(); var tileX = args.Data.ReadInt32();
var tileY = args.Data.ReadInt32(); var tileY = args.Data.ReadInt32();
try
{
var editData = args.Data.ReadInt8(); var editData = args.Data.ReadInt8();
EditType type = (action == EditAction.KillTile || action == EditAction.KillWall || EditType type = (action == EditAction.KillTile || action == EditAction.KillWall ||
action == EditAction.KillTileNoItem) action == EditAction.KillTileNoItem)
@ -1993,9 +1999,14 @@ namespace TShockAPI
if (!args.Player.TilesDestroyed.ContainsKey(coords)) if (!args.Player.TilesDestroyed.ContainsKey(coords))
args.Player.TilesDestroyed.Add(coords, Main.tile[tileX, tileY]); args.Player.TilesDestroyed.Add(coords, Main.tile[tileX, tileY]);
} }
return false; return false;
} }
catch
{
args.Player.SendTileSquare(tileX, tileY, 4);
return true;
}
}
/// <summary> /// <summary>
/// For use with a PaintTile event /// For use with a PaintTile event