Started implementing GPU functionality
This commit is contained in:
parent
789883ad69
commit
3b3600fb68
5
config/menumsg.csv
Normal file
5
config/menumsg.csv
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
setup=1. Create a new profile, or use the default._BREAK_2. Click on the add server button and insert the name of your server._BREAK_3. Navigate to the servers tab, and find your server._BREAK_4. Fill in all the settings with what you want, and remember to check Enabled._BREAK_5. Navigate back to the Control panel and click Start servers
|
||||||
|
runinbk=The program will run in the background. You don't need to have the gui open all the time._BREAK_When in background mode, you can left click on the tray icon to open the gui again. To exit the program, right click the tray icon and press exit.
|
||||||
|
delaystartup=This adds a delay (in seconds) between the start of each server._BREAK_This option should be used for heavy servers with many plugins, but may not be needed on a single server or servers using a few plugins.
|
||||||
|
downloadjars=This option will download all the .jar files available in the program._BREAK_Instead of downloading .jar files when you start servers, it will download all files you don't already have, on startup._BREAK_This will be faster and more reliable than usual._BREAK_You need to restart the software for this setting to take action.
|
||||||
|
about=This software was created to start and manage several servers simultaneously._BREAK_You no longer have to do the tedious work of manually downloading different .jar files every time you want to try something new.
|
|
@ -20,9 +20,6 @@ class Main {
|
|||||||
setup();
|
setup();
|
||||||
GUI window = new GUI();
|
GUI window = new GUI();
|
||||||
window.getFrame().setVisible(true);
|
window.getFrame().setVisible(true);
|
||||||
window.addServer("Server 1");
|
|
||||||
window.addServer("Server 2");
|
|
||||||
window.addServer("Server 3");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package net.knarcraft.serverlauncher.server;
|
package net.knarcraft.serverlauncher.server;
|
||||||
|
|
||||||
|
import net.knarcraft.serverlauncher.userinterface.GUI;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.nio.Buffer;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -18,6 +21,7 @@ public class Server {
|
|||||||
/** Available ram sizes. For GUI dropdown */
|
/** Available ram sizes. For GUI dropdown */
|
||||||
private static final String[] ramList = {"512M", "1G", "2G", "3G", "4G", "5G", "6G", "7G", "8G", "9G", "10G", "11G", "12G", "13G", "14G", "15G", "16G"};
|
private static final String[] ramList = {"512M", "1G", "2G", "3G", "4G", "5G", "6G", "7G", "8G", "9G", "10G", "11G", "12G", "13G", "14G", "15G", "16G"};
|
||||||
private static final ArrayList<Server> servers = new ArrayList<>();
|
private static final ArrayList<Server> servers = new ArrayList<>();
|
||||||
|
private static GUI gui;
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private String path;
|
private String path;
|
||||||
@ -27,8 +31,9 @@ public class Server {
|
|||||||
private String serverVersion;
|
private String serverVersion;
|
||||||
private String maxRam;
|
private String maxRam;
|
||||||
private Process process;
|
private Process process;
|
||||||
|
private BufferedWriter writer;
|
||||||
|
|
||||||
public Server(String name) {
|
public Server(String name, GUI window) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.path = "";
|
this.path = "";
|
||||||
this.enabled = false;
|
this.enabled = false;
|
||||||
@ -38,6 +43,7 @@ public class Server {
|
|||||||
this.maxRam = ramList[0];
|
this.maxRam = ramList[0];
|
||||||
this.process = null;
|
this.process = null;
|
||||||
servers.add(this);
|
servers.add(this);
|
||||||
|
window.addServer(name, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayer(String name) {
|
public void addPlayer(String name) {
|
||||||
@ -53,6 +59,10 @@ public class Server {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setGui(GUI _gui) {
|
||||||
|
gui = _gui;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return A representation of the name of a jarfile.
|
* @return A representation of the name of a jarfile.
|
||||||
*/
|
*/
|
||||||
@ -80,6 +90,24 @@ public class Server {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String[] getRamList() {
|
||||||
|
return ramList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void stop() throws IOException {
|
||||||
|
for (Server server : servers) {
|
||||||
|
if (server.writer != null) {
|
||||||
|
if (server.type.getName() == "Bungee") {
|
||||||
|
server.writer.write("end\n");
|
||||||
|
} else {
|
||||||
|
server.writer.write("stop\n");
|
||||||
|
}
|
||||||
|
server.writer.flush();
|
||||||
|
server.writer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the server's server version to a valid version, or ignores the request.
|
* Sets the server's server version to a valid version, or ignores the request.
|
||||||
*
|
*
|
||||||
@ -113,26 +141,31 @@ public class Server {
|
|||||||
/**
|
/**
|
||||||
* Runs the Minecraft server.
|
* Runs the Minecraft server.
|
||||||
*/
|
*/
|
||||||
private void run() {
|
private boolean run() {
|
||||||
if (this.enabled) {
|
if (this.enabled) {
|
||||||
try {
|
try {
|
||||||
System.out.println("Downloading jar...");
|
gui.setStatus("Downloading jar...");
|
||||||
this.downloadJar();
|
this.downloadJar();
|
||||||
System.out.println("File downloaded.");
|
gui.setStatus("File downloaded");
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
System.out.println("File was not found");
|
||||||
System.out.println("File was not found.");
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ProcessBuilder builder = new ProcessBuilder("java", "-Xmx" + this.maxRam, "-Xms512M", "-Djline.terminal=jline.UnsupportedTerminal", "-Dcom.mojang.eula.agree=true", "-jar", "\"" + this.path + "\\" + this.getType() + "\"");
|
ProcessBuilder builder = new ProcessBuilder("java", "-Xmx" + this.maxRam, "-Xms512M", "-Djline.terminal=jline.UnsupportedTerminal", "-Dcom.mojang.eula.agree=true", "-jar", "\"" + this.path + "\\" + this.getType() + "\"");
|
||||||
builder.directory(new File(this.path));
|
builder.directory(new File(this.path));
|
||||||
builder.redirectErrorStream(true);
|
builder.redirectErrorStream(true);
|
||||||
this.process = builder.start();
|
this.process = builder.start();
|
||||||
System.out.println("Success");
|
OutputStream stdin = this.process.getOutputStream ();
|
||||||
|
this.writer = new BufferedWriter(new OutputStreamWriter(stdin));
|
||||||
|
gui.setStatus("Servers are running");
|
||||||
|
return true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Error");
|
gui.setStatus("Could not start server");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,15 @@ public class ServerType {
|
|||||||
return serverTypes;
|
return serverTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String[] getTypeNames(){
|
||||||
|
ArrayList<ServerType> types = ServerType.getServerTypes();
|
||||||
|
String[] serverTypes = new String[types.size()];
|
||||||
|
for (int i = 0; i < types.size(); i++) {
|
||||||
|
serverTypes[i] = types.get(i).getName();
|
||||||
|
}
|
||||||
|
return serverTypes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads valid server types and version from a file, and creates their objects.
|
* Reads valid server types and version from a file, and creates their objects.
|
||||||
*
|
*
|
||||||
|
@ -1,10 +1,47 @@
|
|||||||
package net.knarcraft.serverlauncher.userinterface;
|
package net.knarcraft.serverlauncher.userinterface;
|
||||||
|
|
||||||
import javax.swing.*;
|
import net.knarcraft.serverlauncher.server.Server;
|
||||||
|
import net.knarcraft.serverlauncher.server.ServerType;
|
||||||
|
|
||||||
public class GUI {
|
import javax.swing.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class GUI implements ActionListener {
|
||||||
|
|
||||||
private JFrame frame;
|
private JFrame frame;
|
||||||
|
//Settings
|
||||||
|
private boolean runInBackground;
|
||||||
|
private int delayStartup;
|
||||||
|
private boolean downloadJars;
|
||||||
|
|
||||||
|
//Menu
|
||||||
|
private JCheckBoxMenuItem chckbxmntmRunInBackground, chckbxmntmDelayStartup, chckbxmntmDownloadJars; //Options
|
||||||
|
private JMenuItem mntmErrors, mntmSetup, mntmManualUpdate; //Help
|
||||||
|
private JMenuItem mntmRunInBackground, mntmDelayStartup, mntmDownloadJars; //Info/options
|
||||||
|
private JMenuItem mntmAbout, mntmStory; //Info/about
|
||||||
|
//Basic controls
|
||||||
|
private JButton btnStartServer, btnStopServer, addServer, backup, addProfile, delProfile;
|
||||||
|
private JComboBox profiles;
|
||||||
|
private final JLabel lblStatuslabel = new JLabel("Servers are stopped");
|
||||||
|
//Server controls
|
||||||
|
private JComboBox targetServer, targetPlayer;
|
||||||
|
private JButton btnKick, btnBan, btnOp, btnDeop, btnCustomCommand, btnSaveserver, btnReload, btnServerConsoles;
|
||||||
|
private JTextField customCommand;
|
||||||
|
//Text
|
||||||
|
private String setupText;
|
||||||
|
private String runInBackgroundText;
|
||||||
|
private String delayStartupText;
|
||||||
|
private String downloadJarsText;
|
||||||
|
private String aboutText;
|
||||||
|
|
||||||
|
|
||||||
private JTabbedPane serversPane;
|
private JTabbedPane serversPane;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,12 +49,18 @@ public class GUI {
|
|||||||
*/
|
*/
|
||||||
public GUI() {
|
public GUI() {
|
||||||
initialize();
|
initialize();
|
||||||
|
loadMessages();
|
||||||
|
Server.setGui(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JFrame getFrame() {
|
public JFrame getFrame() {
|
||||||
return this.frame;
|
return this.frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStatus(String text) {
|
||||||
|
this.lblStatuslabel.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the contents of the frame.
|
* Initialize the contents of the frame.
|
||||||
*/
|
*/
|
||||||
@ -39,202 +82,224 @@ public class GUI {
|
|||||||
JMenu mnOptions = new JMenu("Options");
|
JMenu mnOptions = new JMenu("Options");
|
||||||
menuBar.add(mnOptions);
|
menuBar.add(mnOptions);
|
||||||
|
|
||||||
JCheckBoxMenuItem chckbxmntmRunInBackground = new JCheckBoxMenuItem("Run in background on exit");
|
chckbxmntmRunInBackground = new JCheckBoxMenuItem("Run in background on exit");
|
||||||
mnOptions.add(chckbxmntmRunInBackground);
|
mnOptions.add(chckbxmntmRunInBackground);
|
||||||
|
chckbxmntmRunInBackground.addActionListener(this);
|
||||||
|
|
||||||
JCheckBoxMenuItem chckbxmntmDelayStartup = new JCheckBoxMenuItem("Delay Startup");
|
chckbxmntmDelayStartup = new JCheckBoxMenuItem("Delay Startup");
|
||||||
mnOptions.add(chckbxmntmDelayStartup);
|
mnOptions.add(chckbxmntmDelayStartup);
|
||||||
|
chckbxmntmDelayStartup.addActionListener(this);
|
||||||
|
|
||||||
JCheckBoxMenuItem chckbxmntmDownloadJars = new JCheckBoxMenuItem("Download jars");
|
chckbxmntmDownloadJars = new JCheckBoxMenuItem("Download jars");
|
||||||
mnOptions.add(chckbxmntmDownloadJars);
|
mnOptions.add(chckbxmntmDownloadJars);
|
||||||
|
chckbxmntmDownloadJars.addActionListener(this);
|
||||||
|
|
||||||
JMenu mnHelp = new JMenu("Help");
|
JMenu mnHelp = new JMenu("Help");
|
||||||
menuBar.add(mnHelp);
|
menuBar.add(mnHelp);
|
||||||
|
|
||||||
JMenuItem mntmErrors = new JMenuItem("Errors");
|
mntmErrors = new JMenuItem("Errors");
|
||||||
mnHelp.add(mntmErrors);
|
mnHelp.add(mntmErrors);
|
||||||
|
mntmErrors.addActionListener(this);
|
||||||
|
|
||||||
JMenuItem mntmSetup = new JMenuItem("Setup");
|
mntmSetup = new JMenuItem("Setup");
|
||||||
mnHelp.add(mntmSetup);
|
mnHelp.add(mntmSetup);
|
||||||
|
mntmSetup.addActionListener(this);
|
||||||
|
|
||||||
JMenuItem mntmWarning = new JMenuItem("Warning");
|
mntmManualUpdate = new JMenuItem("Manual update");
|
||||||
mnHelp.add(mntmWarning);
|
|
||||||
|
|
||||||
JMenuItem mntmManualUpdate = new JMenuItem("Manual update");
|
|
||||||
mnHelp.add(mntmManualUpdate);
|
mnHelp.add(mntmManualUpdate);
|
||||||
|
mntmManualUpdate.addActionListener(this);
|
||||||
|
|
||||||
JMenu mnInfo = new JMenu("Info");
|
JMenu mnInfo = new JMenu("Info");
|
||||||
menuBar.add(mnInfo);
|
menuBar.add(mnInfo);
|
||||||
|
|
||||||
JMenu mnOptions_1 = new JMenu("Options");
|
JMenu mnOptionsInfo = new JMenu("Options");
|
||||||
mnInfo.add(mnOptions_1);
|
mnInfo.add(mnOptionsInfo);
|
||||||
|
|
||||||
JMenuItem mntmRunInBackground = new JMenuItem("Run in background on exit");
|
mntmRunInBackground = new JMenuItem("Run in background on exit");
|
||||||
mnOptions_1.add(mntmRunInBackground);
|
mnOptionsInfo.add(mntmRunInBackground);
|
||||||
|
mntmRunInBackground.addActionListener(this);
|
||||||
|
|
||||||
JMenuItem mntmDelayStartup = new JMenuItem("Delay Startup");
|
mntmDelayStartup = new JMenuItem("Delay Startup");
|
||||||
mnOptions_1.add(mntmDelayStartup);
|
mnOptionsInfo.add(mntmDelayStartup);
|
||||||
|
mntmDelayStartup.addActionListener(this);
|
||||||
|
|
||||||
JMenuItem mntmDownloadJars = new JMenuItem("Download jars");
|
mntmDownloadJars = new JMenuItem("Download jars");
|
||||||
mnOptions_1.add(mntmDownloadJars);
|
mnOptionsInfo.add(mntmDownloadJars);
|
||||||
|
mntmDownloadJars.addActionListener(this);
|
||||||
|
|
||||||
JMenu mnAbout = new JMenu("About");
|
JMenu mnAbout = new JMenu("About");
|
||||||
mnInfo.add(mnAbout);
|
mnInfo.add(mnAbout);
|
||||||
|
|
||||||
JMenuItem mntmAbout = new JMenuItem("About");
|
mntmAbout = new JMenuItem("About");
|
||||||
mnAbout.add(mntmAbout);
|
mnAbout.add(mntmAbout);
|
||||||
|
mntmAbout.addActionListener(this);
|
||||||
|
|
||||||
JMenuItem mntmStory = new JMenuItem("Story");
|
mntmStory = new JMenuItem("Story");
|
||||||
mnAbout.add(mntmStory);
|
mnAbout.add(mntmStory);
|
||||||
frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.X_AXIS));
|
frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.X_AXIS));
|
||||||
|
mntmStory.addActionListener(this);
|
||||||
|
|
||||||
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
||||||
frame.getContentPane().add(tabbedPane);
|
frame.getContentPane().add(tabbedPane);
|
||||||
|
|
||||||
JPanel panel = new JPanel();
|
JPanel panelBasic = new JPanel();
|
||||||
tabbedPane.addTab("Control panel", null, panel, null);
|
tabbedPane.addTab("Control panel", null, panelBasic, null);
|
||||||
SpringLayout sl_panel = new SpringLayout();
|
SpringLayout sl_panel = new SpringLayout();
|
||||||
panel.setLayout(sl_panel);
|
panelBasic.setLayout(sl_panel);
|
||||||
|
|
||||||
JLabel lblBasicControls = new JLabel("Basic controls");
|
JLabel lblBasicControls = new JLabel("Basic controls");
|
||||||
sl_panel.putConstraint(SpringLayout.NORTH, lblBasicControls, 10, SpringLayout.NORTH, panel);
|
sl_panel.putConstraint(SpringLayout.NORTH, lblBasicControls, 10, SpringLayout.NORTH, panelBasic);
|
||||||
panel.add(lblBasicControls);
|
panelBasic.add(lblBasicControls);
|
||||||
|
|
||||||
JButton btnStartServer = new JButton("Start servers");
|
btnStartServer = new JButton("Start servers");
|
||||||
sl_panel.putConstraint(SpringLayout.WEST, lblBasicControls, 0, SpringLayout.WEST, btnStartServer);
|
sl_panel.putConstraint(SpringLayout.WEST, lblBasicControls, 0, SpringLayout.WEST, btnStartServer);
|
||||||
sl_panel.putConstraint(SpringLayout.SOUTH, lblBasicControls, -6, SpringLayout.NORTH, btnStartServer);
|
sl_panel.putConstraint(SpringLayout.SOUTH, lblBasicControls, -6, SpringLayout.NORTH, btnStartServer);
|
||||||
sl_panel.putConstraint(SpringLayout.NORTH, btnStartServer, 30, SpringLayout.NORTH, panel);
|
sl_panel.putConstraint(SpringLayout.NORTH, btnStartServer, 30, SpringLayout.NORTH, panelBasic);
|
||||||
sl_panel.putConstraint(SpringLayout.WEST, btnStartServer, 10, SpringLayout.WEST, panel);
|
sl_panel.putConstraint(SpringLayout.WEST, btnStartServer, 10, SpringLayout.WEST, panelBasic);
|
||||||
panel.add(btnStartServer);
|
panelBasic.add(btnStartServer);
|
||||||
|
btnStartServer.addActionListener(this);
|
||||||
|
|
||||||
JButton btnStopServer = new JButton("Stop servers");
|
btnStopServer = new JButton("Stop servers");
|
||||||
sl_panel.putConstraint(SpringLayout.NORTH, btnStopServer, 0, SpringLayout.NORTH, btnStartServer);
|
sl_panel.putConstraint(SpringLayout.NORTH, btnStopServer, 0, SpringLayout.NORTH, btnStartServer);
|
||||||
sl_panel.putConstraint(SpringLayout.WEST, btnStopServer, 6, SpringLayout.EAST, btnStartServer);
|
sl_panel.putConstraint(SpringLayout.WEST, btnStopServer, 6, SpringLayout.EAST, btnStartServer);
|
||||||
panel.add(btnStopServer);
|
panelBasic.add(btnStopServer);
|
||||||
|
btnStopServer.addActionListener(this);
|
||||||
|
|
||||||
JLabel lblProfile = new JLabel("Profile");
|
JLabel lblProfile = new JLabel("Profile");
|
||||||
sl_panel.putConstraint(SpringLayout.NORTH, lblProfile, 6, SpringLayout.SOUTH, btnStartServer);
|
sl_panel.putConstraint(SpringLayout.NORTH, lblProfile, 6, SpringLayout.SOUTH, btnStartServer);
|
||||||
sl_panel.putConstraint(SpringLayout.WEST, lblProfile, 10, SpringLayout.WEST, panel);
|
sl_panel.putConstraint(SpringLayout.WEST, lblProfile, 10, SpringLayout.WEST, panelBasic);
|
||||||
panel.add(lblProfile);
|
panelBasic.add(lblProfile);
|
||||||
|
|
||||||
JButton button = new JButton("+");
|
addProfile = new JButton("+");
|
||||||
sl_panel.putConstraint(SpringLayout.NORTH, button, 6, SpringLayout.SOUTH, lblProfile);
|
sl_panel.putConstraint(SpringLayout.NORTH, addProfile, 6, SpringLayout.SOUTH, lblProfile);
|
||||||
sl_panel.putConstraint(SpringLayout.WEST, button, 10, SpringLayout.WEST, panel);
|
sl_panel.putConstraint(SpringLayout.WEST, addProfile, 10, SpringLayout.WEST, panelBasic);
|
||||||
panel.add(button);
|
panelBasic.add(addProfile);
|
||||||
|
addProfile.addActionListener(this);
|
||||||
|
|
||||||
JButton button_1 = new JButton("-");
|
delProfile = new JButton("-");
|
||||||
sl_panel.putConstraint(SpringLayout.NORTH, button_1, 0, SpringLayout.NORTH, button);
|
sl_panel.putConstraint(SpringLayout.NORTH, delProfile, 0, SpringLayout.NORTH, addProfile);
|
||||||
sl_panel.putConstraint(SpringLayout.WEST, button_1, 6, SpringLayout.EAST, button);
|
sl_panel.putConstraint(SpringLayout.WEST, delProfile, 6, SpringLayout.EAST, addProfile);
|
||||||
panel.add(button_1);
|
panelBasic.add(delProfile);
|
||||||
|
delProfile.addActionListener(this);
|
||||||
|
|
||||||
JComboBox comboBox = new JComboBox();
|
profiles = new JComboBox();
|
||||||
sl_panel.putConstraint(SpringLayout.NORTH, comboBox, 1, SpringLayout.NORTH, button);
|
sl_panel.putConstraint(SpringLayout.NORTH, profiles, 1, SpringLayout.NORTH, addProfile);
|
||||||
sl_panel.putConstraint(SpringLayout.WEST, comboBox, 6, SpringLayout.EAST, button_1);
|
sl_panel.putConstraint(SpringLayout.WEST, profiles, 6, SpringLayout.EAST, delProfile);
|
||||||
sl_panel.putConstraint(SpringLayout.EAST, comboBox, 124, SpringLayout.EAST, button_1);
|
sl_panel.putConstraint(SpringLayout.EAST, profiles, 124, SpringLayout.EAST, delProfile);
|
||||||
panel.add(comboBox);
|
panelBasic.add(profiles);
|
||||||
|
profiles.addActionListener(this);
|
||||||
|
|
||||||
JLabel lblStatuslabel = new JLabel("StatusLabel");
|
sl_panel.putConstraint(SpringLayout.NORTH, lblStatuslabel, 15, SpringLayout.SOUTH, addProfile);
|
||||||
sl_panel.putConstraint(SpringLayout.NORTH, lblStatuslabel, 15, SpringLayout.SOUTH, button);
|
sl_panel.putConstraint(SpringLayout.WEST, lblStatuslabel, 10, SpringLayout.WEST, panelBasic);
|
||||||
sl_panel.putConstraint(SpringLayout.WEST, lblStatuslabel, 10, SpringLayout.WEST, panel);
|
sl_panel.putConstraint(SpringLayout.EAST, lblStatuslabel, 386, SpringLayout.WEST, panelBasic);
|
||||||
sl_panel.putConstraint(SpringLayout.EAST, lblStatuslabel, 386, SpringLayout.WEST, panel);
|
panelBasic.add(lblStatuslabel);
|
||||||
panel.add(lblStatuslabel);
|
|
||||||
|
|
||||||
JButton button_3 = new JButton("Add server");
|
addServer = new JButton("Add server");
|
||||||
sl_panel.putConstraint(SpringLayout.NORTH, button_3, 0, SpringLayout.NORTH, btnStartServer);
|
sl_panel.putConstraint(SpringLayout.NORTH, addServer, 0, SpringLayout.NORTH, btnStartServer);
|
||||||
sl_panel.putConstraint(SpringLayout.WEST, button_3, 6, SpringLayout.EAST, btnStopServer);
|
sl_panel.putConstraint(SpringLayout.WEST, addServer, 6, SpringLayout.EAST, btnStopServer);
|
||||||
panel.add(button_3);
|
panelBasic.add(addServer);
|
||||||
|
addServer.addActionListener(this);
|
||||||
|
|
||||||
JButton button_4 = new JButton("Backup");
|
backup = new JButton("Backup");
|
||||||
sl_panel.putConstraint(SpringLayout.NORTH, button_4, 0, SpringLayout.NORTH, btnStartServer);
|
sl_panel.putConstraint(SpringLayout.NORTH, backup, 0, SpringLayout.NORTH, btnStartServer);
|
||||||
sl_panel.putConstraint(SpringLayout.WEST, button_4, 6, SpringLayout.EAST, button_3);
|
sl_panel.putConstraint(SpringLayout.WEST, backup, 6, SpringLayout.EAST, addServer);
|
||||||
panel.add(button_4);
|
panelBasic.add(backup);
|
||||||
|
backup.addActionListener(this);
|
||||||
|
|
||||||
JPanel panel_1 = new JPanel();
|
JPanel controlServers = new JPanel();
|
||||||
tabbedPane.addTab("Control servers", null, panel_1, null);
|
tabbedPane.addTab("Control servers", null, controlServers, null);
|
||||||
SpringLayout sl_panel_1 = new SpringLayout();
|
SpringLayout sl_panel_1 = new SpringLayout();
|
||||||
panel_1.setLayout(sl_panel_1);
|
controlServers.setLayout(sl_panel_1);
|
||||||
|
|
||||||
JComboBox comboBox_1 = new JComboBox();
|
targetServer = new JComboBox();
|
||||||
sl_panel_1.putConstraint(SpringLayout.NORTH, comboBox_1, 10, SpringLayout.NORTH, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.NORTH, targetServer, 10, SpringLayout.NORTH, controlServers);
|
||||||
sl_panel_1.putConstraint(SpringLayout.SOUTH, comboBox_1, 30, SpringLayout.NORTH, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.SOUTH, targetServer, 30, SpringLayout.NORTH, controlServers);
|
||||||
panel_1.add(comboBox_1);
|
controlServers.add(targetServer);
|
||||||
|
|
||||||
JComboBox comboBox_2 = new JComboBox();
|
targetPlayer = new JComboBox();
|
||||||
sl_panel_1.putConstraint(SpringLayout.NORTH, comboBox_2, 6, SpringLayout.SOUTH, comboBox_1);
|
sl_panel_1.putConstraint(SpringLayout.NORTH, targetPlayer, 6, SpringLayout.SOUTH, targetServer);
|
||||||
sl_panel_1.putConstraint(SpringLayout.SOUTH, comboBox_2, 26, SpringLayout.SOUTH, comboBox_1);
|
sl_panel_1.putConstraint(SpringLayout.SOUTH, targetPlayer, 26, SpringLayout.SOUTH, targetServer);
|
||||||
comboBox_2.setEditable(true);
|
targetPlayer.setEditable(true);
|
||||||
panel_1.add(comboBox_2);
|
controlServers.add(targetPlayer);
|
||||||
|
|
||||||
JButton btnKick = new JButton("Kick");
|
btnKick = new JButton("Kick");
|
||||||
sl_panel_1.putConstraint(SpringLayout.NORTH, btnKick, 9, SpringLayout.NORTH, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.NORTH, btnKick, 9, SpringLayout.NORTH, controlServers);
|
||||||
sl_panel_1.putConstraint(SpringLayout.WEST, btnKick, 6, SpringLayout.EAST, comboBox_1);
|
sl_panel_1.putConstraint(SpringLayout.WEST, btnKick, 6, SpringLayout.EAST, targetServer);
|
||||||
sl_panel_1.putConstraint(SpringLayout.SOUTH, btnKick, 32, SpringLayout.NORTH, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.SOUTH, btnKick, 32, SpringLayout.NORTH, controlServers);
|
||||||
sl_panel_1.putConstraint(SpringLayout.EAST, btnKick, 84, SpringLayout.EAST, comboBox_1);
|
sl_panel_1.putConstraint(SpringLayout.EAST, btnKick, 84, SpringLayout.EAST, targetServer);
|
||||||
panel_1.add(btnKick);
|
controlServers.add(btnKick);
|
||||||
|
btnKick.addActionListener(this);
|
||||||
|
|
||||||
JButton btnBan = new JButton("Ban");
|
btnBan = new JButton("Ban");
|
||||||
sl_panel_1.putConstraint(SpringLayout.NORTH, btnBan, 35, SpringLayout.NORTH, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.NORTH, btnBan, 35, SpringLayout.NORTH, controlServers);
|
||||||
sl_panel_1.putConstraint(SpringLayout.WEST, btnBan, 6, SpringLayout.EAST, comboBox_2);
|
sl_panel_1.putConstraint(SpringLayout.WEST, btnBan, 6, SpringLayout.EAST, targetPlayer);
|
||||||
sl_panel_1.putConstraint(SpringLayout.EAST, btnBan, 84, SpringLayout.EAST, comboBox_2);
|
sl_panel_1.putConstraint(SpringLayout.EAST, btnBan, 84, SpringLayout.EAST, targetPlayer);
|
||||||
panel_1.add(btnBan);
|
controlServers.add(btnBan);
|
||||||
|
btnBan.addActionListener(this);
|
||||||
|
|
||||||
JButton btnOp = new JButton("OP");
|
btnOp = new JButton("OP");
|
||||||
sl_panel_1.putConstraint(SpringLayout.NORTH, btnOp, 9, SpringLayout.NORTH, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.NORTH, btnOp, 9, SpringLayout.NORTH, controlServers);
|
||||||
sl_panel_1.putConstraint(SpringLayout.WEST, btnOp, 287, SpringLayout.WEST, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.WEST, btnOp, 287, SpringLayout.WEST, controlServers);
|
||||||
sl_panel_1.putConstraint(SpringLayout.SOUTH, btnOp, 32, SpringLayout.NORTH, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.SOUTH, btnOp, 32, SpringLayout.NORTH, controlServers);
|
||||||
sl_panel_1.putConstraint(SpringLayout.EAST, btnOp, 370, SpringLayout.WEST, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.EAST, btnOp, 370, SpringLayout.WEST, controlServers);
|
||||||
panel_1.add(btnOp);
|
controlServers.add(btnOp);
|
||||||
|
btnOp.addActionListener(this);
|
||||||
|
|
||||||
JButton btnDeop = new JButton("DEOP");
|
btnDeop = new JButton("DEOP");
|
||||||
sl_panel_1.putConstraint(SpringLayout.WEST, btnDeop, 287, SpringLayout.WEST, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.WEST, btnDeop, 287, SpringLayout.WEST, controlServers);
|
||||||
sl_panel_1.putConstraint(SpringLayout.NORTH, btnDeop, 35, SpringLayout.NORTH, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.NORTH, btnDeop, 35, SpringLayout.NORTH, controlServers);
|
||||||
sl_panel_1.putConstraint(SpringLayout.EAST, btnDeop, 370, SpringLayout.WEST, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.EAST, btnDeop, 370, SpringLayout.WEST, controlServers);
|
||||||
panel_1.add(btnDeop);
|
controlServers.add(btnDeop);
|
||||||
|
btnDeop.addActionListener(this);
|
||||||
|
|
||||||
JLabel lblTargetServer = new JLabel("Target server");
|
JLabel lblTargetServer = new JLabel("Target server");
|
||||||
sl_panel_1.putConstraint(SpringLayout.WEST, comboBox_1, 6, SpringLayout.EAST, lblTargetServer);
|
sl_panel_1.putConstraint(SpringLayout.WEST, targetServer, 6, SpringLayout.EAST, lblTargetServer);
|
||||||
sl_panel_1.putConstraint(SpringLayout.EAST, comboBox_1, 121, SpringLayout.EAST, lblTargetServer);
|
sl_panel_1.putConstraint(SpringLayout.EAST, targetServer, 121, SpringLayout.EAST, lblTargetServer);
|
||||||
sl_panel_1.putConstraint(SpringLayout.NORTH, lblTargetServer, 10, SpringLayout.NORTH, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.NORTH, lblTargetServer, 10, SpringLayout.NORTH, controlServers);
|
||||||
sl_panel_1.putConstraint(SpringLayout.WEST, lblTargetServer, 10, SpringLayout.WEST, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.WEST, lblTargetServer, 10, SpringLayout.WEST, controlServers);
|
||||||
panel_1.add(lblTargetServer);
|
controlServers.add(lblTargetServer);
|
||||||
|
|
||||||
JLabel lblTargetPlayer = new JLabel("Target player");
|
JLabel lblTargetPlayer = new JLabel("Target player");
|
||||||
sl_panel_1.putConstraint(SpringLayout.WEST, comboBox_2, 7, SpringLayout.EAST, lblTargetPlayer);
|
sl_panel_1.putConstraint(SpringLayout.WEST, targetPlayer, 7, SpringLayout.EAST, lblTargetPlayer);
|
||||||
sl_panel_1.putConstraint(SpringLayout.EAST, comboBox_2, 122, SpringLayout.EAST, lblTargetPlayer);
|
sl_panel_1.putConstraint(SpringLayout.EAST, targetPlayer, 122, SpringLayout.EAST, lblTargetPlayer);
|
||||||
sl_panel_1.putConstraint(SpringLayout.NORTH, lblTargetPlayer, 12, SpringLayout.SOUTH, lblTargetServer);
|
sl_panel_1.putConstraint(SpringLayout.NORTH, lblTargetPlayer, 12, SpringLayout.SOUTH, lblTargetServer);
|
||||||
sl_panel_1.putConstraint(SpringLayout.WEST, lblTargetPlayer, 0, SpringLayout.WEST, lblTargetServer);
|
sl_panel_1.putConstraint(SpringLayout.WEST, lblTargetPlayer, 0, SpringLayout.WEST, lblTargetServer);
|
||||||
panel_1.add(lblTargetPlayer);
|
controlServers.add(lblTargetPlayer);
|
||||||
|
|
||||||
JButton btnCustomCommand = new JButton("Custom command");
|
btnCustomCommand = new JButton("Custom command");
|
||||||
sl_panel_1.putConstraint(SpringLayout.WEST, btnCustomCommand, 250, SpringLayout.WEST, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.WEST, btnCustomCommand, 250, SpringLayout.WEST, controlServers);
|
||||||
sl_panel_1.putConstraint(SpringLayout.EAST, btnCustomCommand, 0, SpringLayout.EAST, btnOp);
|
sl_panel_1.putConstraint(SpringLayout.EAST, btnCustomCommand, 0, SpringLayout.EAST, btnOp);
|
||||||
panel_1.add(btnCustomCommand);
|
controlServers.add(btnCustomCommand);
|
||||||
|
btnCustomCommand.addActionListener(this);
|
||||||
|
|
||||||
JTextField textField = new JTextField();
|
customCommand = new JTextField();
|
||||||
sl_panel_1.putConstraint(SpringLayout.WEST, textField, 10, SpringLayout.WEST, panel_1);
|
sl_panel_1.putConstraint(SpringLayout.WEST, customCommand, 10, SpringLayout.WEST, controlServers);
|
||||||
sl_panel_1.putConstraint(SpringLayout.EAST, textField, -6, SpringLayout.WEST, btnCustomCommand);
|
sl_panel_1.putConstraint(SpringLayout.EAST, customCommand, -6, SpringLayout.WEST, btnCustomCommand);
|
||||||
sl_panel_1.putConstraint(SpringLayout.NORTH, btnCustomCommand, -1, SpringLayout.NORTH, textField);
|
sl_panel_1.putConstraint(SpringLayout.NORTH, btnCustomCommand, -1, SpringLayout.NORTH, customCommand);
|
||||||
panel_1.add(textField);
|
controlServers.add(customCommand);
|
||||||
textField.setColumns(10);
|
customCommand.setColumns(10);
|
||||||
|
|
||||||
JButton button_2 = new JButton("Save server");
|
btnSaveserver = new JButton("Save server");
|
||||||
sl_panel_1.putConstraint(SpringLayout.NORTH, textField, 6, SpringLayout.SOUTH, button_2);
|
sl_panel_1.putConstraint(SpringLayout.NORTH, customCommand, 6, SpringLayout.SOUTH, btnSaveserver);
|
||||||
sl_panel_1.putConstraint(SpringLayout.NORTH, button_2, 6, SpringLayout.SOUTH, btnBan);
|
sl_panel_1.putConstraint(SpringLayout.NORTH, btnSaveserver, 6, SpringLayout.SOUTH, btnBan);
|
||||||
sl_panel_1.putConstraint(SpringLayout.WEST, button_2, 0, SpringLayout.WEST, btnKick);
|
sl_panel_1.putConstraint(SpringLayout.WEST, btnSaveserver, 0, SpringLayout.WEST, btnKick);
|
||||||
sl_panel_1.putConstraint(SpringLayout.EAST, button_2, 91, SpringLayout.WEST, btnKick);
|
sl_panel_1.putConstraint(SpringLayout.EAST, btnSaveserver, 91, SpringLayout.WEST, btnKick);
|
||||||
panel_1.add(button_2);
|
controlServers.add(btnSaveserver);
|
||||||
|
btnSaveserver.addActionListener(this);
|
||||||
|
|
||||||
JButton button_5 = new JButton("Reload");
|
btnReload = new JButton("Reload");
|
||||||
sl_panel_1.putConstraint(SpringLayout.NORTH, button_5, 6, SpringLayout.SOUTH, btnDeop);
|
sl_panel_1.putConstraint(SpringLayout.NORTH, btnReload, 6, SpringLayout.SOUTH, btnDeop);
|
||||||
sl_panel_1.putConstraint(SpringLayout.WEST, button_5, 10, SpringLayout.WEST, btnDeop);
|
sl_panel_1.putConstraint(SpringLayout.WEST, btnReload, 10, SpringLayout.WEST, btnDeop);
|
||||||
sl_panel_1.putConstraint(SpringLayout.EAST, button_5, 0, SpringLayout.EAST, btnOp);
|
sl_panel_1.putConstraint(SpringLayout.EAST, btnReload, 0, SpringLayout.EAST, btnOp);
|
||||||
panel_1.add(button_5);
|
controlServers.add(btnReload);
|
||||||
|
btnReload.addActionListener(this);
|
||||||
|
|
||||||
JButton button_6 = new JButton("View server consoles");
|
btnServerConsoles = new JButton("View server consoles");
|
||||||
sl_panel_1.putConstraint(SpringLayout.NORTH, button_6, 0, SpringLayout.NORTH, button_2);
|
sl_panel_1.putConstraint(SpringLayout.NORTH, btnServerConsoles, 0, SpringLayout.NORTH, btnSaveserver);
|
||||||
sl_panel_1.putConstraint(SpringLayout.WEST, button_6, 0, SpringLayout.WEST, lblTargetServer);
|
sl_panel_1.putConstraint(SpringLayout.WEST, btnServerConsoles, 0, SpringLayout.WEST, lblTargetServer);
|
||||||
sl_panel_1.putConstraint(SpringLayout.EAST, button_6, 0, SpringLayout.EAST, comboBox_1);
|
sl_panel_1.putConstraint(SpringLayout.EAST, btnServerConsoles, 0, SpringLayout.EAST, targetServer);
|
||||||
panel_1.add(button_6);
|
controlServers.add(btnServerConsoles);
|
||||||
|
btnServerConsoles.addActionListener(this);
|
||||||
|
|
||||||
JPanel panel_2 = new JPanel();
|
JPanel panel_2 = new JPanel();
|
||||||
tabbedPane.addTab("Servers", null, panel_2, null);
|
tabbedPane.addTab("Servers", null, panel_2, null);
|
||||||
@ -251,7 +316,7 @@ public class GUI {
|
|||||||
this.serversPane = tabbedPane_1;
|
this.serversPane = tabbedPane_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addServer(String name) {
|
public void addServer(String name, Server server) {
|
||||||
JPanel panel = new JPanel();
|
JPanel panel = new JPanel();
|
||||||
this.serversPane.addTab(name, null, panel, null);
|
this.serversPane.addTab(name, null, panel, null);
|
||||||
SpringLayout sl_panel_3 = new SpringLayout();
|
SpringLayout sl_panel_3 = new SpringLayout();
|
||||||
@ -263,7 +328,7 @@ public class GUI {
|
|||||||
sl_panel_3.putConstraint(SpringLayout.SOUTH, lblServerType, 30, SpringLayout.NORTH, panel);
|
sl_panel_3.putConstraint(SpringLayout.SOUTH, lblServerType, 30, SpringLayout.NORTH, panel);
|
||||||
panel.add(lblServerType);
|
panel.add(lblServerType);
|
||||||
|
|
||||||
JComboBox comboBox_3 = new JComboBox();
|
JComboBox<String> comboBox_3 = new JComboBox<>(ServerType.getTypeNames());
|
||||||
sl_panel_3.putConstraint(SpringLayout.NORTH, comboBox_3, 10, SpringLayout.NORTH, panel);
|
sl_panel_3.putConstraint(SpringLayout.NORTH, comboBox_3, 10, SpringLayout.NORTH, panel);
|
||||||
sl_panel_3.putConstraint(SpringLayout.WEST, comboBox_3, 16, SpringLayout.EAST, lblServerType);
|
sl_panel_3.putConstraint(SpringLayout.WEST, comboBox_3, 16, SpringLayout.EAST, lblServerType);
|
||||||
panel.add(comboBox_3);
|
panel.add(comboBox_3);
|
||||||
@ -274,7 +339,7 @@ public class GUI {
|
|||||||
sl_panel_3.putConstraint(SpringLayout.SOUTH, lblServerVersion, 26, SpringLayout.SOUTH, lblServerType);
|
sl_panel_3.putConstraint(SpringLayout.SOUTH, lblServerVersion, 26, SpringLayout.SOUTH, lblServerType);
|
||||||
panel.add(lblServerVersion);
|
panel.add(lblServerVersion);
|
||||||
|
|
||||||
JComboBox comboBox_4 = new JComboBox();
|
JComboBox<String> comboBox_4 = new JComboBox<>(ServerType.getServerTypes().get(0).getVersions());
|
||||||
sl_panel_3.putConstraint(SpringLayout.NORTH, comboBox_4, 6, SpringLayout.SOUTH, comboBox_3);
|
sl_panel_3.putConstraint(SpringLayout.NORTH, comboBox_4, 6, SpringLayout.SOUTH, comboBox_3);
|
||||||
sl_panel_3.putConstraint(SpringLayout.WEST, comboBox_4, 0, SpringLayout.WEST, comboBox_3);
|
sl_panel_3.putConstraint(SpringLayout.WEST, comboBox_4, 0, SpringLayout.WEST, comboBox_3);
|
||||||
panel.add(comboBox_4);
|
panel.add(comboBox_4);
|
||||||
@ -286,7 +351,7 @@ public class GUI {
|
|||||||
sl_panel_3.putConstraint(SpringLayout.EAST, lblMaxRam, -111, SpringLayout.EAST, panel);
|
sl_panel_3.putConstraint(SpringLayout.EAST, lblMaxRam, -111, SpringLayout.EAST, panel);
|
||||||
panel.add(lblMaxRam);
|
panel.add(lblMaxRam);
|
||||||
|
|
||||||
JComboBox comboBox_5 = new JComboBox();
|
JComboBox<String> comboBox_5 = new JComboBox<>(Server.getRamList());
|
||||||
sl_panel_3.putConstraint(SpringLayout.NORTH, comboBox_5, 10, SpringLayout.NORTH, panel);
|
sl_panel_3.putConstraint(SpringLayout.NORTH, comboBox_5, 10, SpringLayout.NORTH, panel);
|
||||||
sl_panel_3.putConstraint(SpringLayout.WEST, comboBox_5, 6, SpringLayout.EAST, lblMaxRam);
|
sl_panel_3.putConstraint(SpringLayout.WEST, comboBox_5, 6, SpringLayout.EAST, lblMaxRam);
|
||||||
sl_panel_3.putConstraint(SpringLayout.EAST, comboBox_5, 86, SpringLayout.EAST, lblMaxRam);
|
sl_panel_3.putConstraint(SpringLayout.EAST, comboBox_5, 86, SpringLayout.EAST, lblMaxRam);
|
||||||
@ -326,4 +391,96 @@ public class GUI {
|
|||||||
sl_panel_3.putConstraint(SpringLayout.EAST, btnBrowse, 0, SpringLayout.EAST, comboBox_5);
|
sl_panel_3.putConstraint(SpringLayout.EAST, btnBrowse, 0, SpringLayout.EAST, comboBox_5);
|
||||||
panel.add(btnBrowse);
|
panel.add(btnBrowse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if (e.getSource() == chckbxmntmRunInBackground) {
|
||||||
|
this.runInBackground = chckbxmntmRunInBackground.isSelected();
|
||||||
|
} else if (e.getSource() == chckbxmntmDelayStartup) {
|
||||||
|
if (chckbxmntmDelayStartup.isSelected()) {
|
||||||
|
this.delayStartup = Integer.parseInt(JOptionPane.showInputDialog("Seconds to delay: "));
|
||||||
|
} else {
|
||||||
|
this.delayStartup = 0;
|
||||||
|
}
|
||||||
|
} else if (e.getSource() == chckbxmntmDownloadJars) {
|
||||||
|
this.downloadJars = chckbxmntmDownloadJars.isSelected();
|
||||||
|
} else if (e.getSource() == mntmErrors) {
|
||||||
|
goToURL("https://knarcraft.net/Bungeeminecraftserverlauncher/Info/");
|
||||||
|
} else if (e.getSource() == mntmSetup) {
|
||||||
|
JOptionPane.showMessageDialog(null, setupText, "Setup", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
} else if (e.getSource() == mntmManualUpdate) {
|
||||||
|
goToURL("https://knarcraft.net/Downloads/Bungeeminecraftserverlauncher/");
|
||||||
|
} else if (e.getSource() == mntmRunInBackground) {
|
||||||
|
JOptionPane.showMessageDialog(null, runInBackgroundText, "Run in background", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
} else if (e.getSource() == mntmDelayStartup) {
|
||||||
|
JOptionPane.showMessageDialog(null, delayStartupText, "Run in background", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
} else if (e.getSource() == mntmDownloadJars) {
|
||||||
|
JOptionPane.showMessageDialog(null, downloadJarsText, "Run in background", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
} else if (e.getSource() == mntmAbout) {
|
||||||
|
JOptionPane.showMessageDialog(null, aboutText, "Run in background", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
} else if (e.getSource() == mntmStory) {
|
||||||
|
goToURL("https://knarcraft.net/Bungeeminecraftserverlauncher/Story/");
|
||||||
|
} else if (e.getSource() == btnStartServer) {
|
||||||
|
Server.startServers();
|
||||||
|
} else if (e.getSource() == btnStopServer) {
|
||||||
|
try {
|
||||||
|
setStatus("Servers are stopping");
|
||||||
|
Server.stop();
|
||||||
|
setStatus("Servers are stopped");
|
||||||
|
} catch (IOException e1) {
|
||||||
|
JOptionPane.showMessageDialog(null, "Could not stop server", "Error", JOptionPane.ERROR_MESSAGE);
|
||||||
|
}
|
||||||
|
} else if (e.getSource() == addServer) {
|
||||||
|
String serverName = JOptionPane.showInputDialog("Name of server: ");
|
||||||
|
new Server(serverName, this);
|
||||||
|
} else if (e.getSource() == backup) {
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
//Basic controls
|
||||||
|
backup, addProfile, delProfile;
|
||||||
|
private JComboBox profiles;
|
||||||
|
private JLabel lblStatuslabel;
|
||||||
|
//Server controls
|
||||||
|
private JComboBox targetServer, targetPlayer;
|
||||||
|
private JButton btnKick, btnBan, btnOp, btnDeop, btnCustomCommand, btnSaveserver, btnReload, btnServerConsoles;
|
||||||
|
private JTextField customCommand;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void goToURL(String url) {
|
||||||
|
java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
|
||||||
|
try {
|
||||||
|
desktop.browse(new URI(url));
|
||||||
|
} catch (URISyntaxException | IOException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadMessages() {
|
||||||
|
try (Scanner in = new Scanner(new File("config/menumsg.csv"))) {
|
||||||
|
while (in.hasNextLine()) {
|
||||||
|
String[] line = in.nextLine().split("=");
|
||||||
|
String content = line[1].replaceAll("_BREAK_",System.getProperty("line.separator"));
|
||||||
|
switch (line[0]) {
|
||||||
|
case "setup":
|
||||||
|
setupText = content;
|
||||||
|
break;
|
||||||
|
case "runinbk":
|
||||||
|
runInBackgroundText = content;
|
||||||
|
break;
|
||||||
|
case "delaystartup":
|
||||||
|
delayStartupText = content;
|
||||||
|
break;
|
||||||
|
case "downloadjars":
|
||||||
|
downloadJarsText = content;
|
||||||
|
break;
|
||||||
|
case "about":
|
||||||
|
aboutText = content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
JOptionPane.showMessageDialog(null, "Messages file could not be read", "Setup", JOptionPane.ERROR_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import javax.naming.ConfigurationException;
|
import javax.naming.ConfigurationException;
|
||||||
|
|
||||||
import net.knarcraft.serverlauncher.server.*;
|
import net.knarcraft.serverlauncher.server.*;
|
||||||
|
import net.knarcraft.serverlauncher.userinterface.GUI;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,33 +15,50 @@ import java.io.*;
|
|||||||
*/
|
*/
|
||||||
class ServerTest {
|
class ServerTest {
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
|
EventQueue.invokeLater(() -> {
|
||||||
|
try {
|
||||||
|
setup();
|
||||||
|
GUI window = new GUI();
|
||||||
|
window.getFrame().setVisible(true);
|
||||||
|
|
||||||
|
|
||||||
|
new Server("Server1", window);
|
||||||
|
Server server1 = Server.getServers().get(0);
|
||||||
|
server1.toggle();
|
||||||
|
server1.setPath("C:\\Users\\Kristian\\Desktop\\Test");
|
||||||
|
server1.setType(ServerType.getServerTypes().get(4));
|
||||||
|
server1.setServerVersion("1.12.2");
|
||||||
|
server1.setMaxRam("1G");
|
||||||
|
Server.startServers();
|
||||||
|
|
||||||
|
|
||||||
|
InputStream stdout = server1.getProcess().getInputStream ();
|
||||||
|
|
||||||
|
BufferedReader reader = new BufferedReader (new InputStreamReader(stdout));
|
||||||
|
|
||||||
|
OutputStream stdin = server1.getProcess().getOutputStream ();
|
||||||
|
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stdin));
|
||||||
|
|
||||||
|
String line;
|
||||||
|
while ((line = reader.readLine ()) != null) {
|
||||||
|
System.out.println ("Stdout: " + line);
|
||||||
|
writer.write("stop\n");
|
||||||
|
writer.flush();
|
||||||
|
}
|
||||||
|
//writer.close();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setup() {
|
||||||
try {
|
try {
|
||||||
ServerType.loadServerTypes();
|
ServerType.loadServerTypes();
|
||||||
} catch (ConfigurationException e) {
|
} catch (ConfigurationException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
new Server("Server1");
|
|
||||||
Server server1 = Server.getServers().get(0);
|
|
||||||
server1.toggle();
|
|
||||||
server1.setPath("C:\\Users\\Kristian\\Desktop\\Test");
|
|
||||||
server1.setType(ServerType.getServerTypes().get(4));
|
|
||||||
server1.setServerVersion("1.12.2");
|
|
||||||
server1.setMaxRam("1G");
|
|
||||||
Server.startServers();
|
|
||||||
|
|
||||||
OutputStream stdin = server1.getProcess().getOutputStream ();
|
|
||||||
InputStream stdout = server1.getProcess().getInputStream ();
|
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader (new InputStreamReader(stdout));
|
|
||||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stdin));
|
|
||||||
|
|
||||||
String line;
|
|
||||||
while ((line = reader.readLine ()) != null) {
|
|
||||||
System.out.println ("Stdout: " + line);
|
|
||||||
writer.write("stop\n");
|
|
||||||
writer.flush();
|
|
||||||
}
|
|
||||||
//writer.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user