Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to modify server launch command #144

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public class ServerPostInstallDialog extends JDialog {
private JLabel serverJarLabel;
private JButton downloadButton;
private JButton generateButton;
private JTextField textField;

private ServerPostInstallDialog(ServerHandler handler) throws HeadlessException {
super(InstallerGui.instance, true);
Expand Down Expand Up @@ -106,7 +107,7 @@ private void initComponents() {

addRow(panel, panel -> panel.add(fontSize(new JLabel(Utils.BUNDLE.getString("prompt.server.info.command")), 15)));
addRow(panel, panel -> {
JTextField textField = new JTextField(launchCommand);
textField = new JTextField(launchCommand);
textField.setHorizontalAlignment(JTextField.CENTER);
panel.add(textField);
});
Expand Down Expand Up @@ -219,8 +220,8 @@ private void doServerJarDownload() {

private void generateLaunchScripts() {
Map<Path, String> launchScripts = new HashMap<>();
launchScripts.put(installDir.resolve("start.bat"), launchCommand + "\npause");
launchScripts.put(installDir.resolve("start.sh"), "#!/usr/bin/env bash\n" + launchCommand);
launchScripts.put(installDir.resolve("start.bat"), textField.getText() + "\npause");
launchScripts.put(installDir.resolve("start.sh"), "#!/usr/bin/env bash\n" + textField.getText());

boolean exists = launchScripts.entrySet().stream().anyMatch(entry -> Files.exists(entry.getKey()));

Expand Down