Don't log IndexOutOfRange exceptions in SendTileSquare
This commit is contained in:
parent
a8ac9435fd
commit
ab55481ddb
1 changed files with 19 additions and 15 deletions
|
|
@ -308,22 +308,26 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
public virtual bool SendTileSquare(int x, int y, int size = 10)
|
||||
{
|
||||
try
|
||||
{
|
||||
int num = (size - 1)/2;
|
||||
SendData(PacketTypes.TileSendSquare, "", size, (x - num), (y - num));
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.ToString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public virtual bool SendTileSquare(int x, int y, int size = 10)
|
||||
{
|
||||
try
|
||||
{
|
||||
int num = (size - 1)/2;
|
||||
SendData(PacketTypes.TileSendSquare, "", size, (x - num), (y - num));
|
||||
return true;
|
||||
}
|
||||
catch (IndexOutOfRangeException)
|
||||
{
|
||||
// This is expected if square exceeds array.
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.ToString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void GiveItem(int type, string name, int width, int height, int stack, int prefix = 0)
|
||||
public virtual void GiveItem(int type, string name, int width, int height, int stack, int prefix = 0)
|
||||
{
|
||||
int itemid = Item.NewItem((int) X, (int) Y, width, height, type, stack, true, prefix);
|
||||
// This is for special pickaxe/hammers/swords etc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue