1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2025-09-05 22:53:11 +02:00
Files
2025-08-21 20:31:21 +02:00

31 lines
879 B
C#

using System.Collections.ObjectModel;
namespace Phantom.Agent.Minecraft.Java;
sealed class JvmArgumentBuilder {
private readonly JvmProperties basicProperties;
private readonly List<string> customArguments = new ();
public JvmArgumentBuilder(JvmProperties basicProperties) {
this.basicProperties = basicProperties;
}
public void Add(string argument) {
customArguments.Add(argument);
}
public void AddProperty(string key, string value) {
customArguments.Add("-D" + key + "=\"" + value + "\""); // TODO test quoting?
}
public void Build(Collection<string> target) {
foreach (var property in customArguments) {
target.Add(property);
}
// In case of duplicate JVM arguments, typically the last one wins.
target.Add("-Xms" + basicProperties.InitialHeapMegabytes + "M");
target.Add("-Xmx" + basicProperties.MaximumHeapMegabytes + "M");
}
}