mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[FEATURE] Manual create ClientProfile
This commit is contained in:
parent
9f8cd7070c
commit
21a203356f
8 changed files with 481 additions and 180 deletions
|
@ -1,6 +1,8 @@
|
||||||
package pro.gravit.launchserver.command.hash;
|
package pro.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import pro.gravit.launcher.Launcher;
|
import pro.gravit.launcher.Launcher;
|
||||||
import pro.gravit.launcher.profiles.ClientProfile;
|
import pro.gravit.launcher.profiles.ClientProfile;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
@ -19,6 +21,8 @@
|
||||||
|
|
||||||
public final class DownloadClientCommand extends Command {
|
public final class DownloadClientCommand extends Command {
|
||||||
|
|
||||||
|
private transient final Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
public DownloadClientCommand(LaunchServer server) {
|
public DownloadClientCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
}
|
}
|
||||||
|
@ -42,31 +46,34 @@ public void invoke(String... args) throws IOException, CommandException {
|
||||||
Path clientDir = server.updatesDir.resolve(args[1]);
|
Path clientDir = server.updatesDir.resolve(args[1]);
|
||||||
|
|
||||||
// Create client dir
|
// Create client dir
|
||||||
LogHelper.subInfo("Creating client dir: '%s'", dirName);
|
logger.info("Creating client dir: '{}'", dirName);
|
||||||
Files.createDirectory(clientDir);
|
Files.createDirectory(clientDir);
|
||||||
|
|
||||||
// Download required client
|
// Download required client
|
||||||
LogHelper.subInfo("Downloading client, it may take some time");
|
logger.info("Downloading client, it may take some time");
|
||||||
//HttpDownloader.downloadZip(server.mirrorManager.getDefaultMirror().getClientsURL(version.name), clientDir);
|
//HttpDownloader.downloadZip(server.mirrorManager.getDefaultMirror().getClientsURL(version.name), clientDir);
|
||||||
server.mirrorManager.downloadZip(clientDir, "clients/%s.zip", versionName);
|
server.mirrorManager.downloadZip(clientDir, "clients/%s.zip", versionName);
|
||||||
|
|
||||||
// Create profile file
|
// Create profile file
|
||||||
LogHelper.subInfo("Creaing profile file: '%s'", dirName);
|
logger.info("Creaing profile file: '{}'", dirName);
|
||||||
ClientProfile client;
|
ClientProfile client;
|
||||||
String profilePath = String.format("pro/gravit/launchserver/defaults/profile%s.cfg", versionName);
|
try {
|
||||||
try (BufferedReader reader = IOHelper.newReader(IOHelper.getResourceURL(profilePath))) {
|
ClientProfile.Version version = ClientProfile.Version.byName(versionName);
|
||||||
client = Launcher.gsonManager.configGson.fromJson(reader, ClientProfile.class);
|
if(version.compareTo(ClientProfile.Version.MC164) <= 0) {
|
||||||
} catch (IOException e) {
|
logger.warn("Minecraft 1.6.4 and below not supported. Use at your own risk");
|
||||||
|
}
|
||||||
|
client = SaveProfilesCommand.makeProfile(version, dirName, SaveProfilesCommand.getMakeProfileOptionsFromDir(clientDir, version));
|
||||||
|
} catch (Throwable e) {
|
||||||
JsonElement clientJson = server.mirrorManager.jsonRequest(null, "GET", "clients/%s.json", versionName);
|
JsonElement clientJson = server.mirrorManager.jsonRequest(null, "GET", "clients/%s.json", versionName);
|
||||||
client = Launcher.gsonManager.configGson.fromJson(clientJson, ClientProfile.class);
|
client = Launcher.gsonManager.configGson.fromJson(clientJson, ClientProfile.class);
|
||||||
}
|
client.setTitle(dirName);
|
||||||
client.setTitle(dirName);
|
client.setDir(dirName);
|
||||||
client.setDir(dirName);
|
client.setUUID(UUID.randomUUID());
|
||||||
client.setUUID(UUID.randomUUID());
|
if (client.getServers() != null) {
|
||||||
if (client.getServers() != null) {
|
ClientProfile.ServerProfile serverProfile = client.getDefaultServerProfile();
|
||||||
ClientProfile.ServerProfile serverProfile = client.getDefaultServerProfile();
|
if (serverProfile != null) {
|
||||||
if (serverProfile != null) {
|
serverProfile.name = dirName;
|
||||||
serverProfile.name = dirName;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try (BufferedWriter writer = IOHelper.newWriter(IOHelper.resolveIncremental(server.profilesDir,
|
try (BufferedWriter writer = IOHelper.newWriter(IOHelper.resolveIncremental(server.profilesDir,
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package pro.gravit.launchserver.command.hash;
|
package pro.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
import pro.gravit.launcher.Launcher;
|
import pro.gravit.launcher.Launcher;
|
||||||
|
import pro.gravit.launcher.hasher.HashedDir;
|
||||||
import pro.gravit.launcher.profiles.ClientProfile;
|
import pro.gravit.launcher.profiles.ClientProfile;
|
||||||
|
import pro.gravit.launcher.profiles.ClientProfileBuilder;
|
||||||
import pro.gravit.launcher.profiles.optional.OptionalFile;
|
import pro.gravit.launcher.profiles.optional.OptionalFile;
|
||||||
|
import pro.gravit.launcher.profiles.optional.OptionalTrigger;
|
||||||
import pro.gravit.launcher.profiles.optional.actions.*;
|
import pro.gravit.launcher.profiles.optional.actions.*;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.command.Command;
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
@ -14,16 +17,103 @@
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class SaveProfilesCommand extends Command {
|
public class SaveProfilesCommand extends Command {
|
||||||
public SaveProfilesCommand(LaunchServer server) {
|
public SaveProfilesCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum MakeProfileOption {
|
||||||
|
LAUNCHWRAPPER, VANILLA, FORGE, FABRIC, LITELOADER
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ClientProfile makeProfile(ClientProfile.Version version, String title, MakeProfileOption... options) {
|
||||||
|
ClientProfileBuilder builder = new ClientProfileBuilder();
|
||||||
|
builder.setVersion(version.name);
|
||||||
|
builder.setDir(title);
|
||||||
|
builder.setAssetDir("asset"+version.name);
|
||||||
|
builder.setAssetIndex(version.name);
|
||||||
|
builder.setInfo("Информация о сервере");
|
||||||
|
builder.setTitle(title);
|
||||||
|
builder.setUuid(UUID.randomUUID());
|
||||||
|
builder.setMainClass(getMainClassByVersion(version, options));
|
||||||
|
builder.setServers(List.of(new ClientProfile.ServerProfile(title, "localhost", 25535)));
|
||||||
|
// ------------
|
||||||
|
builder.setUpdateVerify(List.of("libraries", "natives", "minecraft.jar", "forge.jar", "liteloader.jar", "mods"));
|
||||||
|
builder.setClassPath(List.of("libraries", "minecraft.jar", "forge.jar", "liteloader.jar"));
|
||||||
|
builder.setUpdate(List.of("servers.dat"));
|
||||||
|
List<String> jvmArgs = new ArrayList<>(4);
|
||||||
|
Set<OptionalFile> optionals = new HashSet<>();
|
||||||
|
jvmArgs.add("-XX:+DisableAttachMechanism");
|
||||||
|
// Official Mojang launcher java arguments
|
||||||
|
jvmArgs.add("-XX:+UseG1GC");
|
||||||
|
jvmArgs.add("XX:+UnlockExperimentalVMOptions");
|
||||||
|
jvmArgs.add("-XX:G1NewSizePercent=20");
|
||||||
|
jvmArgs.add("-XX:MaxGCPauseMillis=50");
|
||||||
|
jvmArgs.add("-XX:G1HeapRegionSize=32M");
|
||||||
|
// -----------
|
||||||
|
if(version.compareTo(ClientProfile.Version.MC1122) > 0) {
|
||||||
|
jvmArgs.add("-Djava.library.path=natives");
|
||||||
|
if(optionContains(options, MakeProfileOption.FORGE)) {
|
||||||
|
builder.setClassLoaderConfig(ClientProfile.ClassLoaderConfig.AGENT);
|
||||||
|
}
|
||||||
|
OptionalFile optionalMacOs = new OptionalFile();
|
||||||
|
optionalMacOs.name = "MacOSArgs";
|
||||||
|
optionalMacOs.actions = new ArrayList<>(1);
|
||||||
|
optionalMacOs.actions.add(new OptionalActionJvmArgs(List.of("-XstartOnFirstThread")));
|
||||||
|
optionalMacOs.triggers = new OptionalTrigger[]{ new OptionalTrigger(OptionalTrigger.TriggerType.OS_TYPE, 2) };
|
||||||
|
optionals.add(optionalMacOs);
|
||||||
|
}
|
||||||
|
jvmArgs.add("-Dfml.ignorePatchDiscrepancies=true");
|
||||||
|
jvmArgs.add("-Dfml.ignoreInvalidMinecraftCertificates=true");
|
||||||
|
builder.setJvmArgs(jvmArgs);
|
||||||
|
builder.setUpdateOptional(optionals);
|
||||||
|
List<String> clientArgs = new ArrayList<>();
|
||||||
|
if(optionContains(options, MakeProfileOption.LAUNCHWRAPPER)) {
|
||||||
|
if(optionContains(options, MakeProfileOption.LITELOADER)) {
|
||||||
|
clientArgs.add("--tweakClass");
|
||||||
|
clientArgs.add("com.mumfrey.liteloader.launch.LiteLoaderTweaker");
|
||||||
|
}
|
||||||
|
if(optionContains(options, MakeProfileOption.FORGE)) {
|
||||||
|
clientArgs.add("--tweakClass");
|
||||||
|
if(version.compareTo(ClientProfile.Version.MC1710) > 0) {
|
||||||
|
clientArgs.add("net.minecraftforge.fml.common.launcher.FMLTweaker");
|
||||||
|
} else {
|
||||||
|
clientArgs.add("cpw.mods.fml.common.launcher.FMLTweaker");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
builder.setClientArgs(clientArgs);
|
||||||
|
|
||||||
|
return builder.createClientProfile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean optionContains(MakeProfileOption[] options, MakeProfileOption option) {
|
||||||
|
return Arrays.stream(options).anyMatch(e -> e == option);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMainClassByVersion(ClientProfile.Version version, MakeProfileOption... options) {
|
||||||
|
if(optionContains(options, MakeProfileOption.LAUNCHWRAPPER)) {
|
||||||
|
return "net.minecraft.launchwrapper.Launch";
|
||||||
|
}
|
||||||
|
return "net.minecraft.client.main.Main";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MakeProfileOption[] getMakeProfileOptionsFromDir(Path dir, ClientProfile.Version version) {
|
||||||
|
List<MakeProfileOption> options = new ArrayList<>(2);
|
||||||
|
if(Files.exists(dir.resolve("forge.jar"))) {
|
||||||
|
options.add(MakeProfileOption.FORGE);
|
||||||
|
}
|
||||||
|
if(Files.exists(dir.resolve("liteloader.jar"))) {
|
||||||
|
options.add(MakeProfileOption.LITELOADER);
|
||||||
|
}
|
||||||
|
if(version.compareTo(ClientProfile.Version.MC112) <= 0) {
|
||||||
|
options.add(MakeProfileOption.LAUNCHWRAPPER);
|
||||||
|
}
|
||||||
|
return options.toArray(new MakeProfileOption[0]);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void saveProfile(ClientProfile profile, Path path) throws IOException {
|
public static void saveProfile(ClientProfile profile, Path path) throws IOException {
|
||||||
if (profile.getUUID() == null) profile.setUUID(UUID.randomUUID());
|
if (profile.getUUID() == null) profile.setUUID(UUID.randomUUID());
|
||||||
|
|
|
@ -15,9 +15,9 @@ public static void exit(int code) {
|
||||||
|
|
||||||
public static void setSecurityManager(SecurityManager s) {
|
public static void setSecurityManager(SecurityManager s) {
|
||||||
LogHelper.debug("Try set security manager %s", s == null ? "null" : s.getClass().getName());
|
LogHelper.debug("Try set security manager %s", s == null ? "null" : s.getClass().getName());
|
||||||
if (AuthService.profile == null || AuthService.profile.securityManagerConfig == ClientProfile.SecurityManagerConfig.NONE)
|
if (AuthService.profile == null || AuthService.profile.getSecurityManagerConfig() == ClientProfile.SecurityManagerConfig.NONE)
|
||||||
return;
|
return;
|
||||||
if (AuthService.profile.securityManagerConfig == ClientProfile.SecurityManagerConfig.CLIENT) {
|
if (AuthService.profile.getSecurityManagerConfig() == ClientProfile.SecurityManagerConfig.CLIENT) {
|
||||||
System.setSecurityManager(s);
|
System.setSecurityManager(s);
|
||||||
}
|
}
|
||||||
//TODO NEXT
|
//TODO NEXT
|
||||||
|
|
|
@ -84,7 +84,7 @@ public static void main(String[] args) throws Throwable {
|
||||||
LauncherGuardManager.initGuard(true);
|
LauncherGuardManager.initGuard(true);
|
||||||
LogHelper.debug("Reading ClientLauncher params");
|
LogHelper.debug("Reading ClientLauncher params");
|
||||||
ClientLauncherProcess.ClientParams params = readParams(new InetSocketAddress("127.0.0.1", Launcher.getConfig().clientPort));
|
ClientLauncherProcess.ClientParams params = readParams(new InetSocketAddress("127.0.0.1", Launcher.getConfig().clientPort));
|
||||||
if (params.profile.classLoaderConfig != ClientProfile.ClassLoaderConfig.AGENT) {
|
if (params.profile.getClassLoaderConfig() != ClientProfile.ClassLoaderConfig.AGENT) {
|
||||||
LauncherEngine.verifyNoAgent();
|
LauncherEngine.verifyNoAgent();
|
||||||
}
|
}
|
||||||
ClientProfile profile = params.profile;
|
ClientProfile profile = params.profile;
|
||||||
|
@ -129,7 +129,7 @@ public static void main(String[] args) throws Throwable {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (params.profile.classLoaderConfig == ClientProfile.ClassLoaderConfig.LAUNCHER) {
|
if (params.profile.getClassLoaderConfig() == ClientProfile.ClassLoaderConfig.LAUNCHER) {
|
||||||
ClientClassLoader classLoader = new ClientClassLoader(classpath.toArray(new URL[0]), ClassLoader.getSystemClassLoader());
|
ClientClassLoader classLoader = new ClientClassLoader(classpath.toArray(new URL[0]), ClassLoader.getSystemClassLoader());
|
||||||
ClientLauncherEntryPoint.classLoader = classLoader;
|
ClientLauncherEntryPoint.classLoader = classLoader;
|
||||||
Thread.currentThread().setContextClassLoader(classLoader);
|
Thread.currentThread().setContextClassLoader(classLoader);
|
||||||
|
@ -141,7 +141,7 @@ public static void main(String[] args) throws Throwable {
|
||||||
ClientService.nativePath = classLoader.nativePath;
|
ClientService.nativePath = classLoader.nativePath;
|
||||||
classLoader.addURL(IOHelper.getCodeSource(ClientLauncherEntryPoint.class).toUri().toURL());
|
classLoader.addURL(IOHelper.getCodeSource(ClientLauncherEntryPoint.class).toUri().toURL());
|
||||||
ClientService.baseURLs = classLoader.getURLs();
|
ClientService.baseURLs = classLoader.getURLs();
|
||||||
} else if (params.profile.classLoaderConfig == ClientProfile.ClassLoaderConfig.AGENT) {
|
} else if (params.profile.getClassLoaderConfig() == ClientProfile.ClassLoaderConfig.AGENT) {
|
||||||
ClientLauncherEntryPoint.classLoader = ClassLoader.getSystemClassLoader();
|
ClientLauncherEntryPoint.classLoader = ClassLoader.getSystemClassLoader();
|
||||||
classpath.add(IOHelper.getCodeSource(ClientLauncherEntryPoint.class).toUri().toURL());
|
classpath.add(IOHelper.getCodeSource(ClientLauncherEntryPoint.class).toUri().toURL());
|
||||||
for (URL url : classpath) {
|
for (URL url : classpath) {
|
||||||
|
@ -155,7 +155,7 @@ public static void main(String[] args) throws Throwable {
|
||||||
ClientService.classLoader = classLoader;
|
ClientService.classLoader = classLoader;
|
||||||
ClientService.baseURLs = classpath.toArray(new URL[0]);
|
ClientService.baseURLs = classpath.toArray(new URL[0]);
|
||||||
}
|
}
|
||||||
if(params.profile.runtimeInClientConfig != ClientProfile.RuntimeInClientConfig.NONE) {
|
if(params.profile.getRuntimeInClientConfig() != ClientProfile.RuntimeInClientConfig.NONE) {
|
||||||
CommonHelper.newThread("Client Launcher Thread", true, () -> {
|
CommonHelper.newThread("Client Launcher Thread", true, () -> {
|
||||||
try {
|
try {
|
||||||
engine.start(args);
|
engine.start(args);
|
||||||
|
|
|
@ -117,7 +117,7 @@ public void start(boolean pipeOutput) throws IOException, InterruptedException {
|
||||||
processArgs.add(executeFile.toString());
|
processArgs.add(executeFile.toString());
|
||||||
processArgs.addAll(jvmArgs);
|
processArgs.addAll(jvmArgs);
|
||||||
//ADD CLASSPATH
|
//ADD CLASSPATH
|
||||||
if (params.profile.classLoaderConfig == ClientProfile.ClassLoaderConfig.AGENT) {
|
if (params.profile.getClassLoaderConfig() == ClientProfile.ClassLoaderConfig.AGENT) {
|
||||||
processArgs.add("-javaagent:".concat(IOHelper.getCodeSource(ClientLauncherEntryPoint.class).toAbsolutePath().toString()));
|
processArgs.add("-javaagent:".concat(IOHelper.getCodeSource(ClientLauncherEntryPoint.class).toAbsolutePath().toString()));
|
||||||
}
|
}
|
||||||
if (useLegacyJavaClassPathProperty) {
|
if (useLegacyJavaClassPathProperty) {
|
||||||
|
|
|
@ -15,52 +15,58 @@
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public final class ClientProfile implements Comparable<ClientProfile> {
|
public final class ClientProfile implements Comparable<ClientProfile> {
|
||||||
|
|
||||||
public static final boolean profileCaseSensitive = Boolean.getBoolean("launcher.clientProfile.caseSensitive");
|
|
||||||
private static final FileNameMatcher ASSET_MATCHER = new FileNameMatcher(
|
private static final FileNameMatcher ASSET_MATCHER = new FileNameMatcher(
|
||||||
new String[0], new String[]{"indexes", "objects"}, new String[0]);
|
new String[0], new String[]{"indexes", "objects"}, new String[0]);
|
||||||
// Updater and client watch service
|
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private final List<String> update = new ArrayList<>();
|
private String title;
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private final List<String> updateExclusions = new ArrayList<>();
|
private UUID uuid;
|
||||||
@LauncherNetworkAPI
|
|
||||||
private final List<String> updateShared = new ArrayList<>();
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private final List<String> updateVerify = new ArrayList<>();
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private final Set<OptionalFile> updateOptional = new HashSet<>();
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private final List<String> jvmArgs = new ArrayList<>();
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private final List<String> classPath = new ArrayList<>();
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private final List<String> altClassPath = new ArrayList<>();
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private final List<String> clientArgs = new ArrayList<>();
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private final List<String> compatClasses = new ArrayList<>();
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private final Map<String, String> properties = new HashMap<>();
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private final List<ServerProfile> servers = new ArrayList<>(1);
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
public SecurityManagerConfig securityManagerConfig = SecurityManagerConfig.CLIENT;
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
public ClassLoaderConfig classLoaderConfig = ClassLoaderConfig.LAUNCHER;
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
public SignedClientConfig signedClientConfig = SignedClientConfig.NONE;
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
public RuntimeInClientConfig runtimeInClientConfig = RuntimeInClientConfig.NONE;
|
|
||||||
// Version
|
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private String version;
|
private String version;
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private String assetIndex;
|
private String info;
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private String dir;
|
private String dir;
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
|
private int sortIndex;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private String assetIndex;
|
||||||
|
@LauncherNetworkAPI
|
||||||
private String assetDir;
|
private String assetDir;
|
||||||
|
// Updater and client watch service
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private List<String> update;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private List<String> updateExclusions;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private List<String> updateShared;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private List<String> updateVerify;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private Set<OptionalFile> updateOptional;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private List<String> jvmArgs;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private List<String> classPath;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private List<String> altClassPath;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private List<String> clientArgs;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private List<String> compatClasses;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private Map<String, String> properties;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private List<ServerProfile> servers;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private SecurityManagerConfig securityManagerConfig;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private ClassLoaderConfig classLoaderConfig;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private SignedClientConfig signedClientConfig;
|
||||||
|
@LauncherNetworkAPI
|
||||||
|
private RuntimeInClientConfig runtimeInClientConfig;
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private int recommendJavaVersion = 8;
|
private int recommendJavaVersion = 8;
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
|
@ -71,21 +77,6 @@ public final class ClientProfile implements Comparable<ClientProfile> {
|
||||||
private boolean warnMissJavaVersion = true;
|
private boolean warnMissJavaVersion = true;
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private ProfileDefaultSettings settings = new ProfileDefaultSettings();
|
private ProfileDefaultSettings settings = new ProfileDefaultSettings();
|
||||||
// Client
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private int sortIndex;
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private UUID uuid;
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private String title;
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private String info;
|
|
||||||
@Deprecated
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private String serverAddress;
|
|
||||||
@Deprecated
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
private int serverPort;
|
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
private boolean updateFastCheck;
|
private boolean updateFastCheck;
|
||||||
// Client launcher
|
// Client launcher
|
||||||
|
@ -181,42 +172,22 @@ public int getRecommendJavaVersion() {
|
||||||
return recommendJavaVersion;
|
return recommendJavaVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRecommendJavaVersion(int recommendJavaVersion) {
|
|
||||||
this.recommendJavaVersion = recommendJavaVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMinJavaVersion() {
|
public int getMinJavaVersion() {
|
||||||
return minJavaVersion;
|
return minJavaVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMinJavaVersion(int minJavaVersion) {
|
|
||||||
this.minJavaVersion = minJavaVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMaxJavaVersion() {
|
public int getMaxJavaVersion() {
|
||||||
return maxJavaVersion;
|
return maxJavaVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxJavaVersion(int maxJavaVersion) {
|
|
||||||
this.maxJavaVersion = maxJavaVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isWarnMissJavaVersion() {
|
public boolean isWarnMissJavaVersion() {
|
||||||
return warnMissJavaVersion;
|
return warnMissJavaVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWarnMissJavaVersion(boolean warnMissJavaVersion) {
|
|
||||||
this.warnMissJavaVersion = warnMissJavaVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProfileDefaultSettings getSettings() {
|
public ProfileDefaultSettings getSettings() {
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSettings(ProfileDefaultSettings settings) {
|
|
||||||
this.settings = settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateOptionalGraph() {
|
public void updateOptionalGraph() {
|
||||||
for (OptionalFile file : updateOptional) {
|
for (OptionalFile file : updateOptional) {
|
||||||
if (file.dependenciesFile != null) {
|
if (file.dependenciesFile != null) {
|
||||||
|
@ -234,6 +205,8 @@ public void updateOptionalGraph() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public OptionalFile getOptionalFile(String file, OptionalType type) {
|
public OptionalFile getOptionalFile(String file, OptionalType type) {
|
||||||
for (OptionalFile f : updateOptional)
|
for (OptionalFile f : updateOptional)
|
||||||
|
@ -251,90 +224,6 @@ public Collection<String> getShared() {
|
||||||
return updateShared;
|
return updateShared;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public void markOptional(OptionalFile file) {
|
|
||||||
|
|
||||||
if (file.mark) return;
|
|
||||||
file.mark = true;
|
|
||||||
file.watchEvent(true);
|
|
||||||
if (file.dependencies != null) {
|
|
||||||
for (OptionalFile dep : file.dependencies) {
|
|
||||||
if (dep.dependenciesCount == null) dep.dependenciesCount = new HashSet<>();
|
|
||||||
dep.dependenciesCount.add(file);
|
|
||||||
markOptional(dep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (file.conflict != null) {
|
|
||||||
for (OptionalFile conflict : file.conflict) {
|
|
||||||
unmarkOptional(conflict);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public void unmarkOptional(OptionalFile file) {
|
|
||||||
if (!file.mark) return;
|
|
||||||
file.mark = false;
|
|
||||||
file.watchEvent(false);
|
|
||||||
if (file.dependenciesCount != null) {
|
|
||||||
for (OptionalFile f : file.dependenciesCount) {
|
|
||||||
if (f.isPreset) continue;
|
|
||||||
unmarkOptional(f);
|
|
||||||
}
|
|
||||||
file.dependenciesCount.clear();
|
|
||||||
file.dependenciesCount = null;
|
|
||||||
}
|
|
||||||
if (file.dependencies != null) {
|
|
||||||
for (OptionalFile f : file.dependencies) {
|
|
||||||
if (!f.mark) continue;
|
|
||||||
if (f.dependenciesCount == null) {
|
|
||||||
unmarkOptional(f);
|
|
||||||
} else if (f.dependenciesCount.size() <= 1) {
|
|
||||||
f.dependenciesCount.clear();
|
|
||||||
f.dependenciesCount = null;
|
|
||||||
unmarkOptional(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public void pushOptionalFile(HashedDir dir, boolean digest) {
|
|
||||||
for (OptionalFile opt : updateOptional) {
|
|
||||||
if (opt.type.equals(OptionalType.FILE) && !opt.mark) {
|
|
||||||
for (String file : opt.list)
|
|
||||||
dir.removeR(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public void pushOptionalJvmArgs(Collection<String> jvmArgs1) {
|
|
||||||
for (OptionalFile opt : updateOptional) {
|
|
||||||
if (opt.type.equals(OptionalType.JVMARGS) && opt.mark) {
|
|
||||||
jvmArgs1.addAll(Arrays.asList(opt.list));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public void pushOptionalClientArgs(Collection<String> clientArgs1) {
|
|
||||||
for (OptionalFile opt : updateOptional) {
|
|
||||||
if (opt.type.equals(OptionalType.CLIENTARGS) && opt.mark) {
|
|
||||||
clientArgs1.addAll(Arrays.asList(opt.list));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public void pushOptionalClassPath(pushOptionalClassPathCallback callback) throws IOException {
|
|
||||||
for (OptionalFile opt : updateOptional) {
|
|
||||||
if (opt.type.equals(OptionalType.CLASSPATH) && opt.mark) {
|
|
||||||
callback.run(opt.list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getServerPort() {
|
public int getServerPort() {
|
||||||
ServerProfile profile = getDefaultServerProfile();
|
ServerProfile profile = getDefaultServerProfile();
|
||||||
return profile == null ? 25565 : profile.serverPort;
|
return profile == null ? 25565 : profile.serverPort;
|
||||||
|
@ -485,6 +374,40 @@ public int hashCode() {
|
||||||
return Objects.hash(uuid);
|
return Objects.hash(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SecurityManagerConfig getSecurityManagerConfig() {
|
||||||
|
return securityManagerConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecurityManagerConfig(SecurityManagerConfig securityManagerConfig) {
|
||||||
|
this.securityManagerConfig = securityManagerConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClassLoaderConfig getClassLoaderConfig() {
|
||||||
|
return classLoaderConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassLoaderConfig(ClassLoaderConfig classLoaderConfig) {
|
||||||
|
this.classLoaderConfig = classLoaderConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SignedClientConfig getSignedClientConfig() {
|
||||||
|
return signedClientConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSignedClientConfig(SignedClientConfig signedClientConfig) {
|
||||||
|
this.signedClientConfig = signedClientConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RuntimeInClientConfig getRuntimeInClientConfig() {
|
||||||
|
return runtimeInClientConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRuntimeInClientConfig(RuntimeInClientConfig runtimeInClientConfig) {
|
||||||
|
this.runtimeInClientConfig = runtimeInClientConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public enum Version {
|
public enum Version {
|
||||||
MC125("1.2.5", 29),
|
MC125("1.2.5", 29),
|
||||||
MC147("1.4.7", 51),
|
MC147("1.4.7", 51),
|
||||||
|
@ -575,6 +498,22 @@ public static class ServerProfile {
|
||||||
public InetSocketAddress toSocketAddress() {
|
public InetSocketAddress toSocketAddress() {
|
||||||
return InetSocketAddress.createUnresolved(serverAddress, serverPort);
|
return InetSocketAddress.createUnresolved(serverAddress, serverPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ServerProfile() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerProfile(String name, String serverAddress, int serverPort) {
|
||||||
|
this.name = name;
|
||||||
|
this.serverAddress = serverAddress;
|
||||||
|
this.serverPort = serverPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerProfile(String name, String serverAddress, int serverPort, boolean isDefault) {
|
||||||
|
this.name = name;
|
||||||
|
this.serverAddress = serverAddress;
|
||||||
|
this.serverPort = serverPort;
|
||||||
|
this.isDefault = isDefault;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ProfileDefaultSettings {
|
public static class ProfileDefaultSettings {
|
||||||
|
@ -583,4 +522,56 @@ public static class ProfileDefaultSettings {
|
||||||
public boolean fullScreen;
|
public boolean fullScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ClientProfile() {
|
||||||
|
update = new ArrayList<>();
|
||||||
|
updateExclusions = new ArrayList<>();
|
||||||
|
updateShared = new ArrayList<>();
|
||||||
|
updateVerify = new ArrayList<>();
|
||||||
|
updateOptional = new HashSet<>();
|
||||||
|
jvmArgs = new ArrayList<>();
|
||||||
|
classPath = new ArrayList<>();
|
||||||
|
altClassPath = new ArrayList<>();
|
||||||
|
clientArgs = new ArrayList<>();
|
||||||
|
compatClasses = new ArrayList<>();
|
||||||
|
properties = new HashMap<>();
|
||||||
|
servers = new ArrayList<>(1);
|
||||||
|
securityManagerConfig = SecurityManagerConfig.CLIENT;
|
||||||
|
classLoaderConfig = ClassLoaderConfig.LAUNCHER;
|
||||||
|
signedClientConfig = SignedClientConfig.NONE;
|
||||||
|
runtimeInClientConfig = RuntimeInClientConfig.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfile(List<String> update, List<String> updateExclusions, List<String> updateShared, List<String> updateVerify, Set<OptionalFile> updateOptional, List<String> jvmArgs, List<String> classPath, List<String> altClassPath, List<String> clientArgs, List<String> compatClasses, Map<String, String> properties, List<ServerProfile> servers, SecurityManagerConfig securityManagerConfig, ClassLoaderConfig classLoaderConfig, SignedClientConfig signedClientConfig, RuntimeInClientConfig runtimeInClientConfig, String version, String assetIndex, String dir, String assetDir, int recommendJavaVersion, int minJavaVersion, int maxJavaVersion, boolean warnMissJavaVersion, ProfileDefaultSettings settings, int sortIndex, UUID uuid, String title, String info, boolean updateFastCheck, String mainClass) {
|
||||||
|
this.update = update;
|
||||||
|
this.updateExclusions = updateExclusions;
|
||||||
|
this.updateShared = updateShared;
|
||||||
|
this.updateVerify = updateVerify;
|
||||||
|
this.updateOptional = updateOptional;
|
||||||
|
this.jvmArgs = jvmArgs;
|
||||||
|
this.classPath = classPath;
|
||||||
|
this.altClassPath = altClassPath;
|
||||||
|
this.clientArgs = clientArgs;
|
||||||
|
this.compatClasses = compatClasses;
|
||||||
|
this.properties = properties;
|
||||||
|
this.servers = servers;
|
||||||
|
this.securityManagerConfig = securityManagerConfig;
|
||||||
|
this.classLoaderConfig = classLoaderConfig;
|
||||||
|
this.signedClientConfig = signedClientConfig;
|
||||||
|
this.runtimeInClientConfig = runtimeInClientConfig;
|
||||||
|
this.version = version;
|
||||||
|
this.assetIndex = assetIndex;
|
||||||
|
this.dir = dir;
|
||||||
|
this.assetDir = assetDir;
|
||||||
|
this.recommendJavaVersion = recommendJavaVersion;
|
||||||
|
this.minJavaVersion = minJavaVersion;
|
||||||
|
this.maxJavaVersion = maxJavaVersion;
|
||||||
|
this.warnMissJavaVersion = warnMissJavaVersion;
|
||||||
|
this.settings = settings;
|
||||||
|
this.sortIndex = sortIndex;
|
||||||
|
this.uuid = uuid;
|
||||||
|
this.title = title;
|
||||||
|
this.info = info;
|
||||||
|
this.updateFastCheck = updateFastCheck;
|
||||||
|
this.mainClass = mainClass;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,198 @@
|
||||||
|
package pro.gravit.launcher.profiles;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.profiles.optional.OptionalFile;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class ClientProfileBuilder {
|
||||||
|
private List<String> update = new ArrayList<>();
|
||||||
|
private List<String> updateExclusions = new ArrayList<>();
|
||||||
|
private List<String> updateShared = new ArrayList<>();
|
||||||
|
private List<String> updateVerify = new ArrayList<>();
|
||||||
|
private Set<OptionalFile> updateOptional = new HashSet<>();
|
||||||
|
private List<String> jvmArgs = new ArrayList<>();
|
||||||
|
private List<String> classPath = new ArrayList<>();
|
||||||
|
private List<String> altClassPath = new ArrayList<>();
|
||||||
|
private List<String> clientArgs = new ArrayList<>();
|
||||||
|
private List<String> compatClasses = new ArrayList<>();
|
||||||
|
private Map<String, String> properties = new HashMap<>();
|
||||||
|
private List<ClientProfile.ServerProfile> servers = new ArrayList<>();
|
||||||
|
private ClientProfile.SecurityManagerConfig securityManagerConfig = ClientProfile.SecurityManagerConfig.LAUNCHER;
|
||||||
|
private ClientProfile.ClassLoaderConfig classLoaderConfig = ClientProfile.ClassLoaderConfig.LAUNCHER;
|
||||||
|
private ClientProfile.SignedClientConfig signedClientConfig = ClientProfile.SignedClientConfig.NONE;
|
||||||
|
private ClientProfile.RuntimeInClientConfig runtimeInClientConfig = ClientProfile.RuntimeInClientConfig.NONE;
|
||||||
|
private String version;
|
||||||
|
private String assetIndex;
|
||||||
|
private String dir;
|
||||||
|
private String assetDir;
|
||||||
|
private int recommendJavaVersion = 8;
|
||||||
|
private int minJavaVersion = 8;
|
||||||
|
private int maxJavaVersion = 999;
|
||||||
|
private boolean warnMissJavaVersion = true;
|
||||||
|
private ClientProfile.ProfileDefaultSettings settings = new ClientProfile.ProfileDefaultSettings();
|
||||||
|
private int sortIndex;
|
||||||
|
private UUID uuid;
|
||||||
|
private String title;
|
||||||
|
private String info;
|
||||||
|
private boolean updateFastCheck = true;
|
||||||
|
private String mainClass;
|
||||||
|
|
||||||
|
public ClientProfileBuilder setUpdate(List<String> update) {
|
||||||
|
this.update = update;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setUpdateExclusions(List<String> updateExclusions) {
|
||||||
|
this.updateExclusions = updateExclusions;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setUpdateShared(List<String> updateShared) {
|
||||||
|
this.updateShared = updateShared;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setUpdateVerify(List<String> updateVerify) {
|
||||||
|
this.updateVerify = updateVerify;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setUpdateOptional(Set<OptionalFile> updateOptional) {
|
||||||
|
this.updateOptional = updateOptional;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setJvmArgs(List<String> jvmArgs) {
|
||||||
|
this.jvmArgs = jvmArgs;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setClassPath(List<String> classPath) {
|
||||||
|
this.classPath = classPath;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setAltClassPath(List<String> altClassPath) {
|
||||||
|
this.altClassPath = altClassPath;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setClientArgs(List<String> clientArgs) {
|
||||||
|
this.clientArgs = clientArgs;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setCompatClasses(List<String> compatClasses) {
|
||||||
|
this.compatClasses = compatClasses;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setProperties(Map<String, String> properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setServers(List<ClientProfile.ServerProfile> servers) {
|
||||||
|
this.servers = servers;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setSecurityManagerConfig(ClientProfile.SecurityManagerConfig securityManagerConfig) {
|
||||||
|
this.securityManagerConfig = securityManagerConfig;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setClassLoaderConfig(ClientProfile.ClassLoaderConfig classLoaderConfig) {
|
||||||
|
this.classLoaderConfig = classLoaderConfig;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setSignedClientConfig(ClientProfile.SignedClientConfig signedClientConfig) {
|
||||||
|
this.signedClientConfig = signedClientConfig;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setRuntimeInClientConfig(ClientProfile.RuntimeInClientConfig runtimeInClientConfig) {
|
||||||
|
this.runtimeInClientConfig = runtimeInClientConfig;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setAssetIndex(String assetIndex) {
|
||||||
|
this.assetIndex = assetIndex;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setDir(String dir) {
|
||||||
|
this.dir = dir;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setAssetDir(String assetDir) {
|
||||||
|
this.assetDir = assetDir;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setRecommendJavaVersion(int recommendJavaVersion) {
|
||||||
|
this.recommendJavaVersion = recommendJavaVersion;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setMinJavaVersion(int minJavaVersion) {
|
||||||
|
this.minJavaVersion = minJavaVersion;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setMaxJavaVersion(int maxJavaVersion) {
|
||||||
|
this.maxJavaVersion = maxJavaVersion;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setWarnMissJavaVersion(boolean warnMissJavaVersion) {
|
||||||
|
this.warnMissJavaVersion = warnMissJavaVersion;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setSettings(ClientProfile.ProfileDefaultSettings settings) {
|
||||||
|
this.settings = settings;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setSortIndex(int sortIndex) {
|
||||||
|
this.sortIndex = sortIndex;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setUuid(UUID uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setInfo(String info) {
|
||||||
|
this.info = info;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setUpdateFastCheck(boolean updateFastCheck) {
|
||||||
|
this.updateFastCheck = updateFastCheck;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfileBuilder setMainClass(String mainClass) {
|
||||||
|
this.mainClass = mainClass;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientProfile createClientProfile() {
|
||||||
|
return new ClientProfile(update, updateExclusions, updateShared, updateVerify, updateOptional, jvmArgs, classPath, altClassPath, clientArgs, compatClasses, properties, servers, securityManagerConfig, classLoaderConfig, signedClientConfig, runtimeInClientConfig, version, assetIndex, dir, assetDir, recommendJavaVersion, minJavaVersion, maxJavaVersion, warnMissJavaVersion, settings, sortIndex, uuid, title, info, updateFastCheck, mainClass);
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,21 @@ public class OptionalTrigger {
|
||||||
public long value;
|
public long value;
|
||||||
public long compareMode = 0;
|
public long compareMode = 0;
|
||||||
|
|
||||||
|
public OptionalTrigger() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public OptionalTrigger(TriggerType type, long value) {
|
||||||
|
this.type = type;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OptionalTrigger(TriggerType type, boolean need, long value, long compareMode) {
|
||||||
|
this.type = type;
|
||||||
|
this.need = need;
|
||||||
|
this.value = value;
|
||||||
|
this.compareMode = compareMode;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isTriggered() {
|
public boolean isTriggered() {
|
||||||
long test;
|
long test;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
Loading…
Reference in a new issue