/// <summary> /// Launch a new server /// </summary> /// <param name="server">the server type that will be executed</param> /// <param name="javaVersion">the java version to use</param> /// <param name="jarFile">the jar file to run</param> /// <param name="minMem">the minimum amount of memory to set</param> /// <param name="maxMem">the maximum amount of memory to set</param> /// <param name="defaultParameters">the parameters entered by the user (optional)</param> /// <param name="defaultFlags">the flags entered by the user (optional)</param> /// <param name="automated"> /// If this is an automated launch. Automated launches won't check for server updates and limit /// popups. /// </param> public void LaunchServer(IMinecraftServer server, JavaVersion javaVersion, string jarFile, UInt32 minMem, UInt32 maxMem, string defaultParameters = "", string defaultFlags = "", Boolean automated = false) { server.PrepareLaunch(); string parameters = server.GetLaunchParameters(defaultParameters); string flags = server.GetLaunchFlags(defaultFlags); string argument = parameters + " -Xms" + minMem + "M -Xmx" + maxMem + "M -jar \"" + jarFile + "\" " + flags; string executable = JavaApi.GetJavaPath(javaVersion); ProcessHandler.StartServer(executable, argument, server); }
/// <summary> /// Get the path of the selected java instance /// </summary> /// <returns></returns> public string GetSelectedJavaPath() { return(JavaApi.GetJavaPath(GetSelectedJavaVersion())); }