fix: remove ATLauncher from classpath when launching minecraft

This fixes issues with the launchers libraries overriding those defined by packs
This commit is contained in:
Ryan Dowling 2017-08-13 16:29:23 +10:00
parent 718e36b0e6
commit 9978f33019
5 changed files with 49 additions and 18 deletions

View file

@ -1,7 +1,5 @@
# Changelog
## 3.2.3.7
- Add in Alex default skins for even UUID's
- Add in version_type to the launch arguments
- Fix dependsGroup on extraArguments not working correctly
- Stop showing error dialog when no skin is set by the user and is using default
## 3.2.3.8
- Remove ATLauncher from the classpath when launching Minecraft

View file

@ -37,9 +37,21 @@ Download and install [launch4j](http://sourceforge.net/projects/launch4j/files/l
Make sure to add the directory containing launch4jc to your executable path which for me on 64bit Windows was:
```
C:\Program Files (x86)\Launch4j
`C:\Program Files (x86)\Launch4j`
```
## Running the application
If you wish to run the application in development, you can run the following:
```
mvn exec:java -Dexec.args='--working-dir=D:\\ATLauncher-Testing'
```
Making sure to change the directory to a working directory you wish to use.
## Building artifacts
To build artifacts for release, simply run `mvn install`.
## Plugging In Your Data
To get started with the code and plug in your own data, you need to edit the
/src/main/java/com/atlauncher/data/Constants.java file.

23
pom.xml
View file

@ -6,7 +6,7 @@
<groupId>com.atlauncher</groupId>
<artifactId>atlauncher</artifactId>
<name>ATLauncher</name>
<version>3.2.3.7</version>
<version>3.2.3.8</version>
<organization>
<name>ATLauncher</name>
<url>http://www.github.com/ATLauncher/</url>
@ -87,10 +87,31 @@
<version>17.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.atlauncher.App</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>

View file

@ -18,12 +18,12 @@
package com.atlauncher.data;
public class Constants {
public static final LauncherVersion VERSION = new LauncherVersion(3, 2, 3, 7);
public static final LauncherVersion VERSION = new LauncherVersion(3, 2, 3, 8);
public static final String LAUNCHER_NAME = "ATLauncher";
public static final String API_BASE_URL = "https://api.atlauncher.com/v1/launcher/";
public static final String PASTE_CHECK_URL = "http://paste.atlauncher.com";
public static final String PASTE_API_URL = "http://paste.atlauncher.com/api/create";
public static final Server[] SERVERS = new Server[]{
public static final Server[] SERVERS = new Server[] {
new Server("Auto", "download.nodecdn.net/containers/atl", true, false),
new Server("Backup Server", "anne.nodecdn.net:8080/containers/atl", false, false),
new Server("EU - Amsterdam 1", "bob.nodecdn.net/containers/atl", true, false),
@ -33,6 +33,5 @@ public class Constants {
new Server("US East - Ashburn 2", "bruce.nodecdn.net/containers/atl", true, false),
new Server("US East - Ashburn 3", "dave.nodecdn.net/containers/atl", true, false),
new Server("US West - Phoenix 1", "adam.nodecdn.net/containers/atl", true, false),
new Server("Master Server (Testing Only)", "master.atlcdn.net", false, true)
};
new Server("Master Server (Testing Only)", "master.atlcdn.net", false, true) };
}

View file

@ -82,8 +82,8 @@ public class MCLauncher {
File[] libraryFiles = binFolder.listFiles();
if (binFolder.exists() && libraryFiles != null && libraryFiles.length != 0) {
for (File file : libraryFiles) {
if (file.isDirectory() || file.getName().equalsIgnoreCase(instance.getMinecraftJar().getName()) ||
instance.getLibrariesNeeded().contains(file.getName())) {
if (file.isDirectory() || file.getName().equalsIgnoreCase(instance.getMinecraftJar().getName())
|| instance.getLibrariesNeeded().contains(file.getName())) {
continue;
}
@ -193,7 +193,7 @@ public class MCLauncher {
arguments.add("-Djava.library.path=" + instance.getNativesDirectory().getAbsolutePath());
arguments.add("-cp");
arguments.add(System.getProperty("java.class.path") + cpb.toString());
arguments.add(cpb.toString());
arguments.add(instance.getMainClass());
String props = "[]";
@ -218,8 +218,9 @@ public class MCLauncher {
argument = argument.replace("${auth_access_token}", account.getAccessToken());
argument = argument.replace("${auth_session}", account.getSession(response));
argument = argument.replace("${version_type}", instance.getVersionType());
argument = argument.replace("${user_type}", response.isOffline() ? com.mojang.authlib.UserType.MOJANG
.getName() : response.getAuth().getUserType().getName());
argument = argument.replace("${user_type}",
response.isOffline() ? com.mojang.authlib.UserType.MOJANG.getName()
: response.getAuth().getUserType().getName());
arguments.add(argument);
}
} else {
@ -272,8 +273,8 @@ public class MCLauncher {
argsString = argsString.replace(props, "REDACTED");
}
LogManager.info("Launching Minecraft with the following arguments " + "(user related stuff has been removed):" +
" " + argsString);
LogManager.info("Launching Minecraft with the following arguments " + "(user related stuff has been removed):"
+ " " + argsString);
ProcessBuilder processBuilder = new ProcessBuilder(arguments);
processBuilder.directory(instance.getRootDirectory());
processBuilder.redirectErrorStream(true);