diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/server/Server.java b/src/main/java/net/knarcraft/minecraftserverlauncher/server/Server.java index 40dc806..3348269 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/server/Server.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/server/Server.java @@ -27,12 +27,12 @@ import java.util.concurrent.TimeUnit; */ public class Server { /** - * Available ram sizes. For ServerLauncherGUI dropdown + * Available ram sizes. For ServerLauncherGUI combo */ - 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 jarDirectory = Main.getApplicationWorkDirectory() + File.separator + "files" + File.separator + "Jars" + File.separator; + 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 jarDirectory = Main.getApplicationWorkDirectory() + File.separator + "files" + + File.separator + "Jars" + File.separator; private final String name; private final ArrayList playerList; @@ -67,12 +67,12 @@ public class Server { /** * Initializes a server with the given values * - * @param name

The name of the server

- * @param path

The file path of the folder containing the server files

- * @param enabled

Whether the server is enabled to start the next time servers are started

- * @param typeName

The name of the server type currently in use on the server

- * @param serverVersion

The currently selected server version for the given server type

- * @param maxRam

The maximum amount of ram the server is allowed to use

+ * @param name

The name of the server

+ * @param path

The file path of the folder containing the server files

+ * @param enabled

Whether the server is enabled to start the next time servers are started

+ * @param typeName

The name of the server type currently in use on the server

+ * @param serverVersion

The currently selected server version for the given server type

+ * @param maxRam

The maximum amount of ram the server is allowed to use

*/ public Server(String name, String path, boolean enabled, String typeName, String serverVersion, String maxRam) throws ConfigurationException { this.name = name; @@ -103,9 +103,9 @@ public class Server { } /** - * Tries to stop all enabled servers. + * Tries to stop all enabled servers * - * @throws IOException If a writer's process is already closed but not null. + * @throws IOException

If a writer's process is already closed but not null

*/ public static void stop() throws IOException { for (Collection collection : Main.getController().getCurrentProfile().getCollections()) { @@ -329,7 +329,7 @@ public class Server { /** * Removes a player with the selected name from the player list * - * @param name The name of the player to remove + * @param name

The name of the player to remove

*/ public void removePlayer(String name) { playerList.removeIf(player -> player.equals(name)); @@ -438,7 +438,7 @@ public class Server { } /** - * Downloads necessary .jar file for the server. + * Downloads necessary .jar file for the server * * @throws FileNotFoundException

If the file was not found and could not be acquired

*/ @@ -456,7 +456,7 @@ public class Server { } /** - * Sends a command to this server through its writer. + * Sends a command to this server through its writer * * @param command

Command to send to the server

* @throws IOException

If write fails

diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/server/ServerTypeHandler.java b/src/main/java/net/knarcraft/minecraftserverlauncher/server/ServerTypeHandler.java index 7d1bb02..6196d65 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/server/ServerTypeHandler.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/server/ServerTypeHandler.java @@ -17,9 +17,9 @@ public class ServerTypeHandler { private static final ArrayList serverTypes = new ArrayList<>(); /** - * Gets a list of all server types' names. + * Gets a list of all server types' names * - * @return

A list of strings

+ * @return

A list containing the names of all server types

*/ public static String[] getTypeNames() throws ConfigurationException { if (serverTypes.isEmpty()) { @@ -64,7 +64,7 @@ public class ServerTypeHandler { } /** - * 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 * * @throws ConfigurationException

If anything goes wrong

*/ diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/MessageHandler.java b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/MessageHandler.java index 7366b15..e873fc2 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/MessageHandler.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/MessageHandler.java @@ -54,11 +54,6 @@ public abstract class MessageHandler implements GUI { * @param paneType

The type of the pane

*/ private void showJOptionPane(String title, String message, int paneType) { - JOptionPane.showMessageDialog( - null, - message, - title, - paneType - ); + JOptionPane.showMessageDialog(null, message, title, paneType); } } diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerConsoles.java b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerConsoles.java index 03f959c..e81837a 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerConsoles.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerConsoles.java @@ -4,9 +4,10 @@ import javax.swing.*; import java.awt.*; /** - * A parent window for server consoles. - * Should be toggled with the "View server consoles" button. - * Keeps track of all consoles. + * This class keeps track of all consoles + * + *

A parent window for server consoles. Should be toggled with the "View server consoles" button. + * Keeps track of all consoles.

* * @author Kristian Knarvik * @version 1.0.0 @@ -47,7 +48,7 @@ public class ServerConsoles { /** * Returns the tabbed pane containing the server consoles * - * @return

A tabbed pane

+ * @return

The tabbed pane containing the server consoles

*/ public static JTabbedPane getTabbedPane() { return consolesTabbedPane; diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerTab.java b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerTab.java index d9b2a2d..3e820dc 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerTab.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerTab.java @@ -12,17 +12,19 @@ import java.awt.event.ActionListener; import java.io.File; /** - * Contains all buttons for configuring a server. - * Does some visual stuff by itself, but otherwise reads user inputs. + * Represents a visual server tab used to configure a server * * @author Kristian Knarvik * @version 1.0.0 * @since 1.0.0 */ public class ServerTab implements ActionListener { - private final JComboBox serverTypes, serverVersions, maxRam; - private final JCheckBox chckbxEnabled; - private final JButton btnRemoveServer, btnBrowse; + private final JComboBox serverTypes; + private final JComboBox serverVersions; + private final JComboBox maxRam; + private final JCheckBox enabledCheckbox; + private final JButton removeServerButton; + private final JButton browseButton; private final JTextField directory; private final JPanel panel; private final String name; @@ -81,45 +83,45 @@ public class ServerTab implements ActionListener { panel.add(maxRam); maxRam.addActionListener(this); - chckbxEnabled = new JCheckBox("Enabled"); - sl_panel_3.putConstraint(SpringLayout.WEST, chckbxEnabled, 10, SpringLayout.WEST, panel); - panel.add(chckbxEnabled); - chckbxEnabled.addActionListener(this); + enabledCheckbox = new JCheckBox("Enabled"); + sl_panel_3.putConstraint(SpringLayout.WEST, enabledCheckbox, 10, SpringLayout.WEST, panel); + panel.add(enabledCheckbox); + enabledCheckbox.addActionListener(this); - btnRemoveServer = new JButton("Remove server"); - sl_panel_3.putConstraint(SpringLayout.NORTH, btnRemoveServer, 0, SpringLayout.NORTH, serverVersions); - sl_panel_3.putConstraint(SpringLayout.SOUTH, btnRemoveServer, 0, SpringLayout.SOUTH, serverVersions); - sl_panel_3.putConstraint(SpringLayout.WEST, btnRemoveServer, 6, SpringLayout.EAST, serverVersions); - sl_panel_3.putConstraint(SpringLayout.EAST, btnRemoveServer, -10, SpringLayout.EAST, panel); - panel.add(btnRemoveServer); - btnRemoveServer.addActionListener(this); + removeServerButton = new JButton("Remove server"); + sl_panel_3.putConstraint(SpringLayout.NORTH, removeServerButton, 0, SpringLayout.NORTH, serverVersions); + sl_panel_3.putConstraint(SpringLayout.SOUTH, removeServerButton, 0, SpringLayout.SOUTH, serverVersions); + sl_panel_3.putConstraint(SpringLayout.WEST, removeServerButton, 6, SpringLayout.EAST, serverVersions); + sl_panel_3.putConstraint(SpringLayout.EAST, removeServerButton, -10, SpringLayout.EAST, panel); + panel.add(removeServerButton); + removeServerButton.addActionListener(this); JLabel lblDirectory = new JLabel("Directory"); - sl_panel_3.putConstraint(SpringLayout.WEST, lblDirectory, 6, SpringLayout.EAST, chckbxEnabled); + sl_panel_3.putConstraint(SpringLayout.WEST, lblDirectory, 6, SpringLayout.EAST, enabledCheckbox); panel.add(lblDirectory); directory = new JTextField(); sl_panel_3.putConstraint(SpringLayout.WEST, directory, 6, SpringLayout.EAST, lblDirectory); sl_panel_3.putConstraint(SpringLayout.SOUTH, lblDirectory, 0, SpringLayout.SOUTH, directory); sl_panel_3.putConstraint(SpringLayout.NORTH, lblDirectory, 0, SpringLayout.NORTH, directory); - sl_panel_3.putConstraint(SpringLayout.NORTH, chckbxEnabled, 0, SpringLayout.NORTH, directory); - sl_panel_3.putConstraint(SpringLayout.SOUTH, chckbxEnabled, 0, SpringLayout.SOUTH, directory); + sl_panel_3.putConstraint(SpringLayout.NORTH, enabledCheckbox, 0, SpringLayout.NORTH, directory); + sl_panel_3.putConstraint(SpringLayout.SOUTH, enabledCheckbox, 0, SpringLayout.SOUTH, directory); panel.add(directory); directory.setColumns(10); directory.addActionListener(this); - btnBrowse = new JButton("Browse"); - sl_panel_3.putConstraint(SpringLayout.EAST, directory, -6, SpringLayout.WEST, btnBrowse); - sl_panel_3.putConstraint(SpringLayout.NORTH, btnBrowse, 3, SpringLayout.SOUTH, btnRemoveServer); - sl_panel_3.putConstraint(SpringLayout.EAST, btnBrowse, -10, SpringLayout.EAST, panel); - sl_panel_3.putConstraint(SpringLayout.SOUTH, directory, 0, SpringLayout.SOUTH, btnBrowse); - sl_panel_3.putConstraint(SpringLayout.NORTH, directory, 0, SpringLayout.NORTH, btnBrowse); - panel.add(btnBrowse); - btnBrowse.addActionListener(this); + browseButton = new JButton("Browse"); + sl_panel_3.putConstraint(SpringLayout.EAST, directory, -6, SpringLayout.WEST, browseButton); + sl_panel_3.putConstraint(SpringLayout.NORTH, browseButton, 3, SpringLayout.SOUTH, removeServerButton); + sl_panel_3.putConstraint(SpringLayout.EAST, browseButton, -10, SpringLayout.EAST, panel); + sl_panel_3.putConstraint(SpringLayout.SOUTH, directory, 0, SpringLayout.SOUTH, browseButton); + sl_panel_3.putConstraint(SpringLayout.NORTH, directory, 0, SpringLayout.NORTH, browseButton); + panel.add(browseButton); + browseButton.addActionListener(this); } /** - * Updates the server tab components according to the received parameters. + * Updates the server tab components according to the received parameters * * @param path

The new path of the server tab

* @param isEnabled

Whether to mark the server as enabled

@@ -129,7 +131,7 @@ public class ServerTab implements ActionListener { */ public void setData(String path, boolean isEnabled, String typeName, String serverVersion, String maxRam) throws ConfigurationException { this.directory.setText(path); - this.chckbxEnabled.setSelected(isEnabled); + this.enabledCheckbox.setSelected(isEnabled); this.serverTypes.setSelectedItem(typeName); this.updateServerVersion(); this.serverVersions.setSelectedItem(serverVersion); @@ -202,14 +204,14 @@ public class ServerTab implements ActionListener { * @return

True if this server is enabled

*/ public boolean isEnabled() { - return this.chckbxEnabled.isSelected(); + return this.enabledCheckbox.isSelected(); } @Override public void actionPerformed(ActionEvent e) { - if (e.getSource() == btnRemoveServer) { + if (e.getSource() == removeServerButton) { remove(); - } else if (e.getSource() == btnBrowse) { + } else if (e.getSource() == browseButton) { browse(); } else if (e.getSource() == serverTypes) { try { diff --git a/src/main/resources/menumsg.csv b/src/main/resources/menumsg.csv index 062dd4e..a6d1774 100644 --- a/src/main/resources/menumsg.csv +++ b/src/main/resources/menumsg.csv @@ -1,5 +1,8 @@ -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. \ No newline at end of file +setupText=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 +runInBackgroundText=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. +delayStartupText=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. +downloadJarsText=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. +aboutText=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. +infoURL=https://archive.knarcraft.net/Scripts/BungeeMinecraftServerLauncherInfo/ +manualUpdateURL=https://git.knarcraft.net/KnarCraft/Minecraft-Server-Launcher/releases +storyURL=https://archive.knarcraft.net/Scripts/BungeeMinecraftServerLauncherStory/ \ No newline at end of file