Adds missing comments, simplifies proxy distinction, moves updating to own class and fixes formatting

This commit is contained in:
2020-08-11 19:29:28 +02:00
parent 094a1facb2
commit ab6453cdc3
30 changed files with 845 additions and 593 deletions

View File

@ -6,6 +6,7 @@ import net.knarcraft.minecraftserverlauncher.userinterface.ServerConsoles;
import net.knarcraft.minecraftserverlauncher.userinterface.ServerTab;
import javax.naming.ConfigurationException;
import java.io.Serializable;
/**
* Acts as a wrapper for objects necessary for each server.
@ -14,9 +15,9 @@ import javax.naming.ConfigurationException;
* @version 1.0.0
* @since 1.0.0
*/
public class Collection {
public class Collection implements Serializable {
private final Server server;
private final ServerTab serverTab;
private final transient ServerTab serverTab;
private final Console serverConsole;
private final String name;
@ -32,6 +33,20 @@ public class Collection {
this.name = name;
}
/**
* Creates a new collection with the given server
*
* @param server <p>The server used for as part of the collection</p>
* @throws ConfigurationException <p>If unable to configure the collection</p>
*/
Collection(Server server) throws ConfigurationException {
String serverName = server.getName();
this.serverTab = new ServerTab(serverName);
this.server = server;
this.serverConsole = ServerConsoles.addConsoleTab(serverName);
this.name = serverName;
}
/**
* Creates a new collection with the given parameters
*
@ -41,16 +56,11 @@ public class Collection {
* @param typeName <p>The name of the server type the server uses</p>
* @param serverVersion <p>The version of the running server type.</p>
* @param maxRam <p>The maximum amount of RAM the server is allowed to use.</p>
* @param vanillaVersion <p>The currently selected vanilla version</p>
* @param snapshotVersion <p>The currently selected snapshot version</p>
* @param spongeVanillaVersion <p>The currently selected SpongeVanilla version</p>
* @param bungeeVersion <p>The currently selected Bungee version</p>
*/
Collection(String name, String serverPath, boolean enabled, String typeName, String serverVersion, String maxRam,
String vanillaVersion, String snapshotVersion, String spongeVanillaVersion, String bungeeVersion) throws ConfigurationException {
Collection(String name, String serverPath, boolean enabled, String typeName, String serverVersion, String maxRam)
throws ConfigurationException {
this.serverTab = new ServerTab(name);
this.server = new Server(name, serverPath, enabled, typeName, serverVersion, maxRam, vanillaVersion,
snapshotVersion, spongeVanillaVersion, bungeeVersion);
this.server = new Server(name, serverPath, enabled, typeName, serverVersion, maxRam);
this.serverConsole = ServerConsoles.addConsoleTab(name);
this.name = name;
this.serverTab.setData(serverPath, enabled, typeName, serverVersion, maxRam);