package com.darkyoooooo.jmccc.option;

import java.io.File;
import java.util.Objects;

import com.darkyoooooo.jmccc.util.Utils;

public class EnvironmentOption {

    /**
     * the .minecraft dir
     */
    private File minecraftDir;

    /**
     * the 'java'
     */
    private File javaPath;

    /**
     * Creates a EnvironmentOption with the given .minecraft dir and the given 'java' path.
     * 
     * @param minecraftDir the .minecraft dir
     * @param javaPath the 'java'
     * @throws NullPointerException if <code>minecraftDir==null||javaPath==null</code>
     * @see Utils#getJavaPath()
     */
    public EnvironmentOption(File minecraftDir, File javaPath) {
        Objects.requireNonNull(minecraftDir);
        Objects.requireNonNull(javaPath);

        if (!minecraftDir.getName().equalsIgnoreCase(".minecraft")) {
            throw new IllegalArgumentException("the name of the minecraft directory must be \'.minecraft\'!");
        }
        
        this.minecraftDir = minecraftDir;
        this.javaPath = javaPath;
    }

    /**
     * Creates a EnvironmentOption with the given .minecraft dir and the default 'java' path.
     * 
     * @param minecraftDir the .minecraft dir
     * @throws NullPointerException if <code>minecraftDir==null</code>
     * @see Utils#getJavaPath()
     */
    public EnvironmentOption(File minecraftDir) {
        this(minecraftDir, Utils.getJavaPath());
    }

    /**
     * Creates a EnvironmentOption with the .minecraft dir in the current dir and the default 'java' path.
     * 
     * @see Utils#getJavaPath()
     */
    public EnvironmentOption() {
        this(new File(".minecraft"), Utils.getJavaPath());
    }

    /**
     * Gets the .minecraft dir.
     * 
     * @return the .minecraft dir
     */
    public File getMinecraftDir() {
        return minecraftDir;
    }

    /**
     * Sets the .minecraft dir.
     * 
     * @param minecraftDir the .minecraft dir to set
     * @throws NullPointerException if <code>minecraftDir==null</code>
     */
    public void setMinecraftDir(File minecraftDir) {
        Objects.requireNonNull(minecraftDir);

        this.minecraftDir = minecraftDir;
    }

    /**
     * Gets the java path.
     * 
     * @return the java path
     */
    public File getJavaPath() {
        return javaPath;
    }

    /**
     * Sets the java path.
     * 
     * @param javaPath the java path to set
     * @throws NullPointerException if <code>javaPath==null</code>
     */
    public void setJavaPath(File javaPath) {
        Objects.requireNonNull(javaPath);

        this.javaPath = javaPath;
    }

}

@@ -763,200 +763,8 @@
 th);
-%0A%0A        if (!minecraftDir.getName().equalsIgnoreCase(%22.minecraft%22)) %7B%0A            throw new IllegalArgumentException(%22the name of the minecraft directory must be %5C'.minecraft%5C'!%22);%0A        %7D
 %0A   

work in progress