mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
Merge branch 'release/5.2.8'
This commit is contained in:
commit
6ab0c7d6a2
14 changed files with 100 additions and 28 deletions
|
@ -50,7 +50,7 @@ public final class LaunchServerConfig {
|
|||
|
||||
public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env) {
|
||||
LaunchServerConfig newConfig = new LaunchServerConfig();
|
||||
newConfig.mirrors = new String[]{"https://mirror.gravit.pro/", "https://gravit-launcher-mirror.storage.googleapis.com/"};
|
||||
newConfig.mirrors = new String[]{"https://mirror.gravit.pro/5.2.x/", "https://gravit-launcher-mirror.storage.googleapis.com/"};
|
||||
newConfig.launch4j = new LaunchServerConfig.ExeConf();
|
||||
newConfig.launch4j.enabled = true;
|
||||
newConfig.launch4j.copyright = "© GravitLauncher Team";
|
||||
|
@ -169,6 +169,18 @@ public void verify() {
|
|||
if (netty == null) {
|
||||
throw new NullPointerException("Netty must not be null");
|
||||
}
|
||||
// Mirror check
|
||||
{
|
||||
boolean updateMirror = Boolean.getBoolean("launchserver.config.disableUpdateMirror");
|
||||
if(!updateMirror) {
|
||||
for(int i=0;i < mirrors.length;++i) {
|
||||
if("https://mirror.gravit.pro/".equals(mirrors[i])) {
|
||||
logger.warn("Replace mirror 'https://mirror.gravit.pro/' to 'https://mirror.gravit.pro/5.2.x/'. If you really need to use original url, use '-Dlaunchserver.config.disableUpdateMirror=true'");
|
||||
mirrors[i] = "https://mirror.gravit.pro/5.2.x/";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void init(LaunchServer.ReloadType type) {
|
||||
|
|
|
@ -97,6 +97,17 @@ public static ClientProfile makeProfile(ClientProfile.Version version, String ti
|
|||
optionalOther.triggersList = List.of(nonMacTrigger);
|
||||
optionals.add(optionalOther);
|
||||
}
|
||||
Optional<MakeProfileOptionLog4j> logFile = findOption(options, MakeProfileOptionLog4j.class);
|
||||
if(logFile.isPresent()) {
|
||||
var log4jOption = logFile.get();
|
||||
if(log4jOption.logFile != null) {
|
||||
jvmArgs.add("-Dlog4j.configurationFile=".concat(logFile.get().logFile));
|
||||
} else if(log4jOption.affected) {
|
||||
if(version.compareTo(ClientProfile.Version.MC117) >= 0 && version.compareTo(ClientProfile.Version.MC118) < 0) {
|
||||
jvmArgs.add("-Dlog4j2.formatMsgNoLookups=true");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (version.compareTo(ClientProfile.Version.MC117) >= 0) {
|
||||
builder.setMinJavaVersion(16);
|
||||
builder.setRecommendJavaVersion(16);
|
||||
|
@ -156,18 +167,52 @@ public static String getMainClassByVersion(ClientProfile.Version version, MakePr
|
|||
return "net.minecraft.client.main.Main";
|
||||
}
|
||||
|
||||
private static boolean isAffectedLog4jVersion(String version) {
|
||||
if(version == null) {
|
||||
return true;
|
||||
}
|
||||
String[] split = version.split("\\.");
|
||||
if(split.length < 2) return true;
|
||||
if(!split[0].equals("2")) return false;
|
||||
return Integer.parseInt(split[1]) < 15;
|
||||
}
|
||||
|
||||
private static String getLog4jVersion(Path dir) throws IOException {
|
||||
Path log4jCore = dir.resolve("org/apache/logging/log4j/log4j-core");
|
||||
if(Files.exists(log4jCore)) {
|
||||
Path target = Files.list(log4jCore).findFirst().orElse(null);
|
||||
if(target != null) {
|
||||
return target.getFileName().toString();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MakeProfileOption[] getMakeProfileOptionsFromDir(Path dir, ClientProfile.Version version) throws IOException {
|
||||
List<MakeProfileOption> options = new ArrayList<>(2);
|
||||
if (version.compareTo(ClientProfile.Version.MC1122) <= 0) {
|
||||
if (Files.exists(dir.resolve("forge.jar"))) {
|
||||
if (Files.exists(dir.resolve("forge.jar"))) {
|
||||
options.add(new MakeProfileOptionForge());
|
||||
}
|
||||
else if (Files.exists(dir.resolve("libraries/net/minecraftforge/forge"))) {
|
||||
if(version.compareTo(ClientProfile.Version.MC1122) > 0) {
|
||||
options.add(new MakeProfileOptionForge(dir));
|
||||
} else {
|
||||
options.add(new MakeProfileOptionForge());
|
||||
}
|
||||
} else {
|
||||
if (Files.exists(dir.resolve("libraries/net/minecraftforge/forge"))) {
|
||||
options.add(new MakeProfileOptionForge(dir));
|
||||
}
|
||||
if (Files.exists(dir.resolve("libraries/net/fabricmc/fabric-loader"))) {
|
||||
options.add(new MakeProfileOptionFabric(dir));
|
||||
}
|
||||
if (Files.exists(dir.resolve("libraries/net/fabricmc/fabric-loader"))) {
|
||||
options.add(new MakeProfileOptionFabric(dir));
|
||||
}
|
||||
{
|
||||
String log4jVersion = getLog4jVersion(dir);
|
||||
if(log4jVersion != null) {
|
||||
|
||||
boolean affected = isAffectedLog4jVersion(log4jVersion);
|
||||
if(Files.exists(dir.resolve("log4j2_custom.xml"))) {
|
||||
options.add(new MakeProfileOptionLog4j(affected, "log4j2_custom.xml"));
|
||||
} else {
|
||||
options.add(new MakeProfileOptionLog4j(affected, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Files.exists(dir.resolve("liteloader.jar"))) {
|
||||
|
@ -176,7 +221,7 @@ public static MakeProfileOption[] getMakeProfileOptionsFromDir(Path dir, ClientP
|
|||
if (Files.exists(dir.resolve("libraries/org/lwjgl/lwjgl/3.2.2")) && Files.exists(dir.resolve("libraries/org/lwjgl/lwjgl/3.2.1"))) {
|
||||
options.add(new MakeProfileOptionLwjgl());
|
||||
}
|
||||
if (version.compareTo(ClientProfile.Version.MC1122) <= 0) {
|
||||
if (Files.exists(dir.resolve("libraries/forge/launchwrapper-1.12-launcherfixed.jar.jar")) || Files.exists(dir.resolve("libraries/net/minecraft/launchwrapper"))) {
|
||||
options.add(new MakeProfileOptionLaunchWrapper());
|
||||
}
|
||||
return options.toArray(new MakeProfileOption[0]);
|
||||
|
@ -193,6 +238,16 @@ private static Path findFirstMavenFile(Path path) throws IOException {
|
|||
public interface MakeProfileOption {
|
||||
}
|
||||
|
||||
public static class MakeProfileOptionLog4j implements MakeProfileOption {
|
||||
public boolean affected;
|
||||
public String logFile;
|
||||
|
||||
public MakeProfileOptionLog4j(boolean lower15, String logFile) {
|
||||
this.affected = lower15;
|
||||
this.logFile = logFile;
|
||||
}
|
||||
}
|
||||
|
||||
public static class MakeProfileOptionForge implements MakeProfileOption {
|
||||
public String launchTarget;
|
||||
public String forgeVersion;
|
||||
|
|
|
@ -33,7 +33,9 @@ public LaunchServerGsonManager(LaunchServerModulesManager modulesManager) {
|
|||
@Override
|
||||
public void registerAdapters(GsonBuilder builder) {
|
||||
super.registerAdapters(builder);
|
||||
builder.registerTypeAdapterFactory(RecordTypeAdapterFactory.DEFAULT);
|
||||
builder.registerTypeAdapterFactory(RecordTypeAdapterFactory.builder()
|
||||
.allowMissingComponentValues()
|
||||
.create());
|
||||
builder.registerTypeAdapter(TextureProvider.class, new UniversalJsonAdapter<>(TextureProvider.providers));
|
||||
builder.registerTypeAdapter(AuthCoreProvider.class, new UniversalJsonAdapter<>(AuthCoreProvider.providers));
|
||||
builder.registerTypeAdapter(PasswordVerifier.class, new UniversalJsonAdapter<>(PasswordVerifier.providers));
|
||||
|
|
|
@ -119,7 +119,8 @@ public static void main(String[] args) throws Throwable {
|
|||
|
||||
// Verify ClientLauncher sign and classpath
|
||||
LogHelper.debug("Verifying ClientLauncher sign and classpath");
|
||||
List<URL> classpath = resolveClassPath(clientDir, params.actions, params.profile).map(IOHelper::toURL).collect(Collectors.toList());
|
||||
List<Path> classpath = resolveClassPath(clientDir, params.actions, params.profile).collect(Collectors.toList());
|
||||
List<URL> classpathURLs = classpath.stream().map(IOHelper::toURL).collect(Collectors.toList());
|
||||
// Start client with WatchService monitoring
|
||||
boolean digest = !profile.isUpdateFastCheck();
|
||||
RequestService service;
|
||||
|
@ -145,7 +146,8 @@ public static void main(String[] args) throws Throwable {
|
|||
}
|
||||
ClientProfile.ClassLoaderConfig classLoaderConfig = profile.getClassLoaderConfig();
|
||||
if (classLoaderConfig == ClientProfile.ClassLoaderConfig.LAUNCHER) {
|
||||
ClientClassLoader classLoader = new ClientClassLoader(classpath.toArray(new URL[0]), ClassLoader.getSystemClassLoader());
|
||||
ClientClassLoader classLoader = new ClientClassLoader(classpathURLs.toArray(new URL[0]), ClassLoader.getSystemClassLoader());
|
||||
System.setProperty("java.class.path", classpath.stream().map(Path::toString).collect(Collectors.joining(File.pathSeparator)));
|
||||
ClientLauncherEntryPoint.classLoader = classLoader;
|
||||
Thread.currentThread().setContextClassLoader(classLoader);
|
||||
classLoader.nativePath = clientDir.resolve("natives").toString();
|
||||
|
@ -156,19 +158,19 @@ public static void main(String[] args) throws Throwable {
|
|||
ClientService.baseURLs = classLoader.getURLs();
|
||||
} else if (classLoaderConfig == ClientProfile.ClassLoaderConfig.AGENT) {
|
||||
ClientLauncherEntryPoint.classLoader = ClassLoader.getSystemClassLoader();
|
||||
classpath.add(IOHelper.getCodeSource(ClientLauncherEntryPoint.class).toUri().toURL());
|
||||
for (URL url : classpath) {
|
||||
classpathURLs.add(IOHelper.getCodeSource(ClientLauncherEntryPoint.class).toUri().toURL());
|
||||
for (URL url : classpathURLs) {
|
||||
LauncherAgent.addJVMClassPath(Paths.get(url.toURI()));
|
||||
}
|
||||
ClientService.instrumentation = LauncherAgent.inst;
|
||||
ClientService.nativePath = clientDir.resolve("natives").toString();
|
||||
LauncherEngine.modulesManager.invokeEvent(new ClientProcessClassLoaderEvent(engine, classLoader, profile));
|
||||
ClientService.classLoader = classLoader;
|
||||
ClientService.baseURLs = classpath.toArray(new URL[0]);
|
||||
ClientService.baseURLs = classpathURLs.toArray(new URL[0]);
|
||||
} else if (classLoaderConfig == ClientProfile.ClassLoaderConfig.SYSTEM_ARGS) {
|
||||
ClientLauncherEntryPoint.classLoader = ClassLoader.getSystemClassLoader();
|
||||
ClientService.classLoader = ClassLoader.getSystemClassLoader();
|
||||
ClientService.baseURLs = classpath.toArray(new URL[0]);
|
||||
ClientService.baseURLs = classpathURLs.toArray(new URL[0]);
|
||||
}
|
||||
AuthService.username = params.playerProfile.username;
|
||||
AuthService.uuid = params.playerProfile.uuid;
|
||||
|
|
|
@ -15,7 +15,7 @@ public final class PlayerProfile {
|
|||
|
||||
public PlayerProfile(UUID uuid, String username, Texture skin, Texture cloak) {
|
||||
this.uuid = Objects.requireNonNull(uuid, "uuid");
|
||||
this.username = VerifyHelper.verifyUsername(username);
|
||||
this.username = username;
|
||||
this.skin = skin;
|
||||
this.cloak = cloak;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public final class CheckServerRequest extends Request<CheckServerRequestEvent> i
|
|||
|
||||
|
||||
public CheckServerRequest(String username, String serverID) {
|
||||
this.username = VerifyHelper.verifyUsername(username);
|
||||
this.username = username;
|
||||
this.serverID = VerifyHelper.verifyServerID(serverID);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ public final class JoinServerRequest extends Request<JoinServerRequestEvent> imp
|
|||
|
||||
|
||||
public JoinServerRequest(String username, String accessToken, String serverID) {
|
||||
this.username = VerifyHelper.verifyUsername(username);
|
||||
this.username = username;
|
||||
this.accessToken = accessToken;
|
||||
this.serverID = VerifyHelper.verifyServerID(serverID);
|
||||
}
|
||||
|
|
|
@ -21,8 +21,6 @@ public BatchProfileByUsernameRequest(String... usernames) throws IOException {
|
|||
this.list[i].username = usernames[i];
|
||||
}
|
||||
IOHelper.verifyLength(usernames.length, IOHelper.MAX_BATCH_SIZE);
|
||||
for (String username : usernames)
|
||||
VerifyHelper.verifyUsername(username);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,7 +12,7 @@ public final class ProfileByUsernameRequest extends Request<ProfileByUsernameReq
|
|||
|
||||
|
||||
public ProfileByUsernameRequest(String username) {
|
||||
this.username = VerifyHelper.verifyUsername(username);
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,7 @@ public final class Version implements Comparable<Version> {
|
|||
|
||||
public static final int MAJOR = 5;
|
||||
public static final int MINOR = 2;
|
||||
public static final int PATCH = 7;
|
||||
public static final int PATCH = 8;
|
||||
public static final int BUILD = 1;
|
||||
public static final Version.Type RELEASE = Type.STABLE;
|
||||
public final int major;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
|
@ -77,6 +78,8 @@ public synchronized static List<JavaVersion> findJava() {
|
|||
tryAddJava(javaPaths, result, JavaVersion.getByPath(p1));
|
||||
trySearchJava(javaPaths, result, p1.getParent());
|
||||
}
|
||||
} catch (InvalidPathException ignored) {
|
||||
|
||||
} catch (IOException e) {
|
||||
LogHelper.error(e);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
id 'org.openjfx.javafxplugin' version '0.0.10' apply false
|
||||
}
|
||||
group = 'pro.gravit.launcher'
|
||||
version = '5.2.7'
|
||||
version = '5.2.8'
|
||||
|
||||
apply from: 'props.gradle'
|
||||
|
||||
|
|
2
modules
2
modules
|
@ -1 +1 @@
|
|||
Subproject commit dced154854c59d8b1e816ebfb1f51baaaeafabfb
|
||||
Subproject commit 4eb5b32678202efcff2d7cf8f87bdf32eab5384d
|
|
@ -1,7 +1,7 @@
|
|||
project.ext {
|
||||
verAsm = '9.2'
|
||||
verNetty = '4.1.70.Final'
|
||||
verOshiCore = '5.8.5'
|
||||
verOshiCore = '6.0.0'
|
||||
verJunit = '5.8.2'
|
||||
verGuavaC = '30.1.1-jre'
|
||||
verJansi = '2.3.4'
|
||||
|
@ -11,7 +11,7 @@
|
|||
verGson = '2.8.9'
|
||||
verBcpkix = '1.70'
|
||||
verSlf4j = '1.7.32'
|
||||
verLog4j = '2.15.0'
|
||||
verLog4j = '2.17.1'
|
||||
verMySQLConn = '8.0.27'
|
||||
verPostgreSQLConn = '42.3.1'
|
||||
verProguard = '7.2.0-beta2'
|
||||
|
|
Loading…
Reference in a new issue