public void Unload() { try { if (status == PluginStatus.Active) { mainBot.CommandManager.UnregisterPlugin(this); } if (proxy != null) { proxy.Stop(); } if (domain != null) { AppDomain.Unload(domain); } } finally { proxy = null; domain = null; status = PluginStatus.Off; } }