Fixed exception in commands crashing the server

Removed Tools.WriteError using Log.Error instead.
This commit is contained in:
ricky 2011-06-15 20:54:32 +10:00
parent 8d13023dac
commit 1ea6d2e955
5 changed files with 31 additions and 34 deletions

View file

@ -176,6 +176,21 @@ namespace TShockAPI
HandleCommandLine(Environment.GetCommandLineArgs());
}
public override void DeInitialize()
{
Bans.SaveBans();
ConfigurationManager.WriteJsonConfiguration();
GameHooks.PostInitialize -= OnPostInit;
GameHooks.Update -= OnUpdate;
ServerHooks.Chat -= OnChat;
ServerHooks.Join -= OnJoin;
ServerHooks.Leave -= OnLeave;
ServerHooks.Command -= ServerHooks_OnCommand;
NetHooks.GetData -= GetData;
NetHooks.GreetPlayer -= OnGreetPlayer;
NpcHooks.StrikeNpc -= NpcHooks_OnStrikeNpc;
}
/// <summary>
/// Handles exceptions that we didn't catch or that Red fucked up
/// </summary>
@ -195,6 +210,11 @@ namespace TShockAPI
Log.Error(e.ExceptionObject.ToString());
}
/*
* Hooks:
*
*/
/// <summary>
/// When a server command is run.
/// </summary>
@ -254,25 +274,6 @@ namespace TShockAPI
Log.Info(string.Format("Server said: {0}", text.Remove(0, 4)));
}
public override void DeInitialize()
{
Bans.SaveBans();
ConfigurationManager.WriteJsonConfiguration();
GameHooks.PostInitialize -= OnPostInit;
GameHooks.Update -= OnUpdate;
ServerHooks.Chat -= OnChat;
ServerHooks.Join -= OnJoin;
ServerHooks.Leave -= OnLeave;
ServerHooks.Command -= ServerHooks_OnCommand;
NetHooks.GetData -= GetData;
NetHooks.GreetPlayer -= OnGreetPlayer;
NpcHooks.StrikeNpc -= NpcHooks_OnStrikeNpc;
}
/*
* Hooks:
* */
private void NpcHooks_OnStrikeNpc(NpcStrikeEventArgs e)
{
if (ConfigurationManager.InfiniteInvasion)