package com.example.addon;

import net.minecraft.client.network.ServerAddress;

import java.util.ArrayList;
import java.util.List;

public class LauncherManger {
    public LauncherManger(){}

    public List<launcher> launcherList = null;

    public void start(String gamedir, int num, String usernamePrefix, ServerAddress address){
        launcherList = new ArrayList<>();
        for(int i = 0; i < num; i++){
            launcher l = new launcher(gamedir, usernamePrefix, i, address);
            l.start();
            launcherList.add(l);
        }
    }

    public void stop(){
        if(launcherList == null) return;

        for(int i = 0; i < launcherList.size(); i++){
            launcherList.get(i).stop();
        }

        launcherList = null;
    }

    public boolean running(){
        return launcherList != null;
    }
}
