All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.k3nder.core.mc.Vmc Maven / Gradle / Ivy

package net.k3nder.core.mc;

import net.k3nder.core.json.version.versionJson;
import net.k3nder.core.mc.clients.CType;
import net.kender.Kjson.Json;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.nio.charset.StandardCharsets;


public class Vmc {
    private final String id;
    private final VersionType type;
    private final URI url;
    private String versionID;
    private CType loader;
    public CType getLoader() {
		return loader;
	}
	public void setLoader(CType loader) {
		this.loader = loader;
	}
	public String getVersionID() {
		return versionID;
	}
	public void setVersionID(String versionID) {
		this.versionID = versionID;
	}


    public Vmc(String name, VersionType x, URI url, String id){
        this.id = name;
        this.versionID = id;
        this.type = x;
        this.url = url;
    }
    public Vmc(String name, VersionType x, URI url, String id, CType s){
        this.id = name;
        this.versionID = id;
        this.type = x;
        this.url = url;
        this.loader = s;
    }

    public String getID(){
        return id;
    }

    public VersionType getType(){
        return type;
    }

    public URI getUrl(){
        return url;
    }

    public String toString(){
        return id;
    }
    public boolean equals(Vmc a) {
    	return id.equals(a.getID()) && type.equals(a.getType()) && url.equals(a.getUrl());
    }

    public versionJson cloneLoad(File file) throws IOException {
        cloneOn(file);
        return versionJson.load(file);
    }

    public void cloneOn(File file) throws IOException {
        FileUtils.writeStringToFile(file, Json.sCcontentOf(String.valueOf(url)), StandardCharsets.UTF_8);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy