From e3c09f28d5f6d772bf1ee2c0cc91b6e8f81c4d8a Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 3 Feb 2012 19:49:24 -0600 Subject: [PATCH 1/3] Derp --- TShockAPI/Commands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 9bdd5284..3feb0311 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -721,7 +721,7 @@ namespace TShockAPI } try { - args.Player.SendMessage("IP Address: " + players[0].IP + " Logged In As: " + players[0].UserAccountName + "Group: " + players[0].Group.Name, Color.Green); + args.Player.SendMessage("IP Address: " + players[0].IP + " Logged In As: " + players[0].UserAccountName + " Group: " + players[0].Group.Name, Color.Green); } catch (Exception) { From 1c8442f72b8d15a213f068669f3324ad3376fa6b Mon Sep 17 00:00:00 2001 From: Deathmax Date: Sat, 4 Feb 2012 09:52:33 +0800 Subject: [PATCH 2/3] Warn instead of error. --- TShockAPI/PacketBufferer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/PacketBufferer.cs b/TShockAPI/PacketBufferer.cs index dc9db11c..fa057a64 100644 --- a/TShockAPI/PacketBufferer.cs +++ b/TShockAPI/PacketBufferer.cs @@ -196,15 +196,15 @@ namespace TShockAPI } catch (ObjectDisposedException e) { - Log.Error(e.ToString()); + Log.Warn(e.ToString()); } catch (SocketException e) { - Log.Error(e.ToString()); + Log.Warn(e.ToString()); } catch (IOException e) { - Log.Error(e.ToString()); + Log.Warn(e.ToString()); } return false; } From 46a653da9992d961bad223ef35e68b71363ccda0 Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Sat, 4 Feb 2012 16:39:36 -0500 Subject: [PATCH 3/3] Added config option for how often to save ssi, and applied that to the save checker. Changed the OnTileEdit hook to take a player as well, so we know who is doing the edit. Changed the output of the Debug folder to go back to bin\Debug\ since I dont work 3 directories about TShock. --- TShockAPI/ConfigFile.cs | 2 ++ TShockAPI/GetDataHandlers.cs | 10 ++++++++-- TShockAPI/TShock.cs | 2 +- TShockAPI/TShockAPI.csproj | 6 +++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index f1caa8f8..4bb88a62 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -151,6 +151,8 @@ namespace TShockAPI [Description("Enable Server Side Inventory checks, EXPERIMENTAL")] public bool ServerSideInventory; + [Description("How often SSI should save, in minutes")] public int ServerSideInventorySave = 15; + [Description("Time, in milliseconds, to disallow discarding items after logging in when ServerSideInventory is ON")] public int LogonDiscardThreshold=250; [Description("Disables reporting of playercount to the stat system.")] public bool DisablePlayerCountReporting; diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 279ab251..96b9b19d 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -57,6 +57,11 @@ namespace TShockAPI /// public class TileEditEventArgs : HandledEventArgs { + /// + /// The TSPlayer who made the tile edit + /// + public TSPlayer Player { get; set; } + /// /// The tile coordinate on the X plane /// @@ -82,13 +87,14 @@ namespace TShockAPI /// TileEdit - called when a tile is placed or destroyed /// public static HandlerList TileEdit; - private static bool OnTileEdit(int x, int y, byte type, byte editType) + private static bool OnTileEdit(TSPlayer ply, int x, int y, byte type, byte editType) { if (TileEdit == null) return false; var args = new TileEditEventArgs { + Player = ply, X = x, Y = y, Type = type, @@ -1598,7 +1604,7 @@ namespace TShockAPI var tileX = args.Data.ReadInt32(); var tileY = args.Data.ReadInt32(); var tiletype = args.Data.ReadInt8(); - if (OnTileEdit(tileX, tileY, tiletype, type)) + if (OnTileEdit(args.Player, tileX, tileY, tiletype, type)) return true; if (tileX < 0 || tileX >= Main.maxTilesX || tileY < 0 || tileY >= Main.maxTilesY) return false; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 2f4394e8..9bdd096b 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -446,7 +446,7 @@ namespace TShockAPI LastCheck = DateTime.UtcNow; } - if ((DateTime.UtcNow - LastSave).TotalMinutes >= 15) + if ((DateTime.UtcNow - LastSave).TotalMinutes >= Config.ServerSideInventorySave) { foreach (TSPlayer player in Players) { diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index 2f8b8a19..3968ad3f 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -32,12 +32,12 @@ true full false - ..\..\..\Tshock Debug\ServerPlugins\ + bin\Debug\ DEBUG;TRACE prompt 4 true - ..\..\..\Tshock Debug\ServerPlugins\TShockAPI.XML + bin\Debug\TShockAPI.XML pdbonly @@ -187,7 +187,7 @@ - +