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