package leigh.mud.engine;

import leigh.continuity.line.BasicLineHandler;
import leigh.continuity.line.CommandLineProcessor;
import leigh.continuity.line.LineProcessor;
import leigh.continuity.line.LineProcessorFactory;

import java.io.IOException;

/**
 * Factory to create {@link MudSession} objects.
 *
 * @author Alex Leigh
 */
public class MudSessionFactory implements LineProcessorFactory {
    private final MudEngine engine;

    public MudSessionFactory(MudEngine engine) {
        this.engine = engine;
    }

    @Override
    public LineProcessor build(BasicLineHandler lineHandler) throws IOException {
        return new CommandLineProcessor(new MudSession(engine, lineHandler));
    }
}
