Add 'javaAgents' to LaunchOptions
This commit is contained in:
@@ -40,6 +40,7 @@ public class LaunchOptions implements Serializable {
|
||||
private String profileName;
|
||||
private List<String> gameArguments = new ArrayList<>();
|
||||
private List<String> javaArguments = new ArrayList<>();
|
||||
private List<String> javaAgents = new ArrayList<>(0);
|
||||
private Integer minMemory;
|
||||
private Integer maxMemory;
|
||||
private Integer metaspace;
|
||||
@@ -114,6 +115,11 @@ public class LaunchOptions implements Serializable {
|
||||
return Collections.unmodifiableList(javaArguments);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<String> getJavaAgents() {
|
||||
return Collections.unmodifiableList(javaAgents);
|
||||
}
|
||||
|
||||
/**
|
||||
* The minimum memory that the JVM can allocate.
|
||||
*/
|
||||
@@ -310,6 +316,10 @@ public class LaunchOptions implements Serializable {
|
||||
return options.javaArguments;
|
||||
}
|
||||
|
||||
public List<String> getJavaAgents() {
|
||||
return options.javaAgents;
|
||||
}
|
||||
|
||||
/**
|
||||
* The minimum memory that the JVM can allocate.
|
||||
*/
|
||||
@@ -460,6 +470,12 @@ public class LaunchOptions implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setJavaAgents(List<String> javaAgents) {
|
||||
options.javaAgents.clear();
|
||||
options.javaAgents.addAll(javaAgents);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMinMemory(Integer minMemory) {
|
||||
options.minMemory = minMemory;
|
||||
return this;
|
||||
|
||||
@@ -259,6 +259,10 @@ public class DefaultLauncher extends Launcher {
|
||||
if (argumentsFromAuthInfo != null && argumentsFromAuthInfo.getJvm() != null && !argumentsFromAuthInfo.getJvm().isEmpty())
|
||||
res.addAll(Arguments.parseArguments(argumentsFromAuthInfo.getJvm(), configuration));
|
||||
|
||||
for (String javaAgent : options.getJavaAgents()) {
|
||||
res.add("-javaagent:" + javaAgent);
|
||||
}
|
||||
|
||||
res.add(version.getMainClass());
|
||||
|
||||
res.addAll(Arguments.parseStringArguments(version.getMinecraftArguments().map(StringUtils::tokenize).orElseGet(ArrayList::new), configuration));
|
||||
|
||||
Reference in New Issue
Block a user