diff --git a/TShockAPI/Log.cs b/TShockAPI/Log.cs index cb89e1e2..1258c874 100644 --- a/TShockAPI/Log.cs +++ b/TShockAPI/Log.cs @@ -79,6 +79,16 @@ namespace TShockAPI { Write(message, LogLevel.Error); } + + /// + /// Writes an error to the log file. + /// + /// The message to be written. + public static void ConsoleError(String message) + { + Console.WriteLine(message); + Write(message, LogLevel.Error); + } /// /// Writes a warning to the log file. diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 62add030..3019f38a 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.3.0.0629")] -[assembly: AssemblyFileVersion("2.3.0.0629")] +[assembly: AssemblyVersion("2.3.0.0630")] +[assembly: AssemblyFileVersion("2.3.0.0630")] diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index e36c06f0..c2654f44 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -307,14 +307,14 @@ namespace TShockAPI if (Main.netMode != 2 || e.Handled) return; - if (msg.whoAmI != ply) + var tsplr = Players[msg.whoAmI]; + + if (msg.whoAmI != ply || tsplr == null) { e.Handled = Tools.HandleGriefer(Players[ply], "Faking Chat"); return; } - var tsplr = Players[msg.whoAmI]; - if (tsplr.Group.HasPermission("adminchat") && !text.StartsWith("/")) { Tools.Broadcast(ConfigurationManager.AdminChatPrefix + "<" + tsplr.Name + "> " + text, @@ -325,8 +325,15 @@ namespace TShockAPI if (text.StartsWith("/")) { - if (Commands.HandleCommand(tsplr, text)) - e.Handled = true; + try + { + e.Handled = Commands.HandleCommand(tsplr, text); + } + catch (Exception ex) + { + Log.ConsoleError("Command exception"); + Log.Error(ex.ToString()); + } } else {