protected override void Dispose(bool connectionLost) { RunCatchLog(() => Context.PlayerSettings.GetAllAsList().ForEach(p => PlayerAdapter.UpdateTimePlayed(p.Login)), "Error updatimg TimePlayed for all players while disposing the plugin."); DisposePlugins(connectionLost); // enforce connection close here later Context.RPCClient.Callbacks.BeginRace -= Callbacks_BeginRace; Context.RPCClient.Callbacks.EndRace -= Callbacks_EndRace; Context.RPCClient.Callbacks.PlayerConnect -= Callbacks_PlayerConnect; Context.RPCClient.Callbacks.PlayerDisconnect -= Callbacks_PlayerDisconnect; Context.RPCClient.Callbacks.PlayerFinish -= Callbacks_PlayerFinish; Context.RPCClient.Callbacks.PlayerChat -= Callbacks_PlayerChat; }
private void Callbacks_PlayerDisconnect(object sender, PlayerDisconnectEventArgs e) { RunCatchLog(() => PlayerAdapter.UpdateTimePlayed(e.Login), "Error in Callbacks_PlayerDisconnect Method.", true); }