private void RemoveConnection(Connection connection, bool raiseEvent)
{
if (connection == null)
return;
connection.Disconnect();
if (connection.Client != null
&& connection.Client.player != null)
{
connection.Client.player.InstancedObjects.Clear();
connection.Client.player.m_Buffs.Clear();
}
// Remove the connection from the dictionary and raise the OnDisconnection event.
lock (ConnectionLock)
{
if (Connections.Contains(connection))
Connections.Remove(connection);
}
if (raiseEvent)
NotifyRemoveConnection(connection);
}