Improves a lot of comments and variable names
This commit is contained in:
parent
d06cc66f31
commit
83f8834530
@ -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<String> playerList;
|
||||
@ -67,12 +67,12 @@ public class Server {
|
||||
/**
|
||||
* Initializes a server with the given values
|
||||
*
|
||||
* @param name <p>The name of the server</p>
|
||||
* @param path <p>The file path of the folder containing the server files</p>
|
||||
* @param enabled <p>Whether the server is enabled to start the next time servers are started</p>
|
||||
* @param typeName <p>The name of the server type currently in use on the server</p>
|
||||
* @param serverVersion <p>The currently selected server version for the given server type</p>
|
||||
* @param maxRam <p>The maximum amount of ram the server is allowed to use</p>
|
||||
* @param name <p>The name of the server</p>
|
||||
* @param path <p>The file path of the folder containing the server files</p>
|
||||
* @param enabled <p>Whether the server is enabled to start the next time servers are started</p>
|
||||
* @param typeName <p>The name of the server type currently in use on the server</p>
|
||||
* @param serverVersion <p>The currently selected server version for the given server type</p>
|
||||
* @param maxRam <p>The maximum amount of ram the server is allowed to use</p>
|
||||
*/
|
||||
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 <p>If a writer's process is already closed but not null</p>
|
||||
*/
|
||||
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 <p>The name of the player to remove</p>
|
||||
*/
|
||||
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 <p>If the file was not found and could not be acquired</p>
|
||||
*/
|
||||
@ -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 <p>Command to send to the server</p>
|
||||
* @throws IOException <p>If write fails</p>
|
||||
|
@ -17,9 +17,9 @@ public class ServerTypeHandler {
|
||||
private static final ArrayList<ServerType> serverTypes = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Gets a list of all server types' names.
|
||||
* Gets a list of all server types' names
|
||||
*
|
||||
* @return <p>A list of strings</p>
|
||||
* @return <p>A list containing the names of all server types</p>
|
||||
*/
|
||||
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 <p>If anything goes wrong</p>
|
||||
*/
|
||||
|
@ -54,11 +54,6 @@ public abstract class MessageHandler implements GUI {
|
||||
* @param paneType <p>The type of the pane</p>
|
||||
*/
|
||||
private void showJOptionPane(String title, String message, int paneType) {
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
message,
|
||||
title,
|
||||
paneType
|
||||
);
|
||||
JOptionPane.showMessageDialog(null, message, title, paneType);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
*
|
||||
* <p>A parent window for server consoles. Should be toggled with the "View server consoles" button.
|
||||
* Keeps track of all consoles.</p>
|
||||
*
|
||||
* @author Kristian Knarvik <kristian.knarvik@knett.no>
|
||||
* @version 1.0.0
|
||||
@ -47,7 +48,7 @@ public class ServerConsoles {
|
||||
/**
|
||||
* Returns the tabbed pane containing the server consoles
|
||||
*
|
||||
* @return <p>A tabbed pane</p>
|
||||
* @return <p>The tabbed pane containing the server consoles</p>
|
||||
*/
|
||||
public static JTabbedPane getTabbedPane() {
|
||||
return consolesTabbedPane;
|
||||
|
@ -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 <kristian.knarvik@knett.no>
|
||||
* @version 1.0.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class ServerTab implements ActionListener {
|
||||
private final JComboBox<String> serverTypes, serverVersions, maxRam;
|
||||
private final JCheckBox chckbxEnabled;
|
||||
private final JButton btnRemoveServer, btnBrowse;
|
||||
private final JComboBox<String> serverTypes;
|
||||
private final JComboBox<String> serverVersions;
|
||||
private final JComboBox<String> 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 <p>The new path of the server tab</p>
|
||||
* @param isEnabled <p>Whether to mark the server as enabled</p>
|
||||
@ -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 <p>True if this server is enabled</p>
|
||||
*/
|
||||
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 {
|
||||
|
@ -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.
|
||||
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/
|
|
Loading…
Reference in New Issue
Block a user