From ab55481ddb03188e56e8ad1fcd2205a3c5d3ffd1 Mon Sep 17 00:00:00 2001 From: Deathmax Date: Thu, 26 Jan 2012 09:50:42 +0800 Subject: [PATCH] Don't log IndexOutOfRange exceptions in SendTileSquare --- TShockAPI/TSPlayer.cs | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 154eaf63..4fc03df4 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -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