org.to2mbn.jmccc.mojangapi.MojangAPIBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmccc-mojang-api Show documentation
Show all versions of jmccc-mojang-api Show documentation
JMCCC is a powerful open-source library for launching and downloading Minecraft.
The newest version!
package org.to2mbn.jmccc.mojangapi;
import org.to2mbn.jmccc.auth.yggdrasil.core.io.DebugHttpRequester;
import org.to2mbn.jmccc.auth.yggdrasil.core.io.HttpRequester;
import org.to2mbn.jmccc.util.Builder;
import java.net.Proxy;
public class MojangAPIBuilder implements Builder {
private MojangAPIProvider apiProvider;
private Proxy proxy;
private boolean debug;
public static MojangAPIBuilder create() {
return new MojangAPIBuilder();
}
public static MojangAPI buildDefault() {
return create().build();
}
public MojangAPIBuilder apiProvider(MojangAPIProvider apiProvider) {
this.apiProvider = apiProvider;
return this;
}
public MojangAPIBuilder proxy(Proxy proxy) {
this.proxy = proxy;
return this;
}
public MojangAPIBuilder debug(boolean debug) {
this.debug = debug;
return this;
}
protected MojangAPIProvider buildAPIProvider() {
return apiProvider == null ? new DefaultMojangAPIProvider() : apiProvider;
}
protected HttpRequester buildHttpRequester() {
HttpRequester requester = debug ? new DebugHttpRequester() : new HttpRequester();
requester.setProxy(proxy);
return requester;
}
@Override
public MojangAPI build() {
return new MojangAPIImpl(buildHttpRequester(), buildAPIProvider());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy