Does some much needed cleanup, adds the Paper server type and fixes broken downloads
Some checks failed
KnarCraft/Minecraft-Server-Launcher/pipeline/head There was a failure building this commit

This commit is contained in:
2020-08-06 19:55:27 +02:00
parent 9ef314b178
commit 26cc5370e2
30 changed files with 1722 additions and 1557 deletions

View File

@ -1,16 +1,18 @@
package net.knarcraft.minecraftserverlauncher.profile;
import net.knarcraft.minecraftserverlauncher.userinterface.ServerTab;
import net.knarcraft.minecraftserverlauncher.server.Server;
import net.knarcraft.minecraftserverlauncher.userinterface.ServerConsoles;
import net.knarcraft.minecraftserverlauncher.userinterface.Console;
import net.knarcraft.minecraftserverlauncher.userinterface.ServerConsoles;
import net.knarcraft.minecraftserverlauncher.userinterface.ServerTab;
import javax.naming.ConfigurationException;
/**
* Acts as a wrapper for objects necessary for each server.
*
* @author Kristian Knarvik <kristian.knarvik@knett.no>
* @version 1.0.0
* @since 1.0.0
* @author Kristian Knarvik <kristian.knarvik@knett.no>
* @version 1.0.0
* @since 1.0.0
*/
public class Collection {
private final Server server;
@ -20,9 +22,10 @@ public class Collection {
/**
* Creates a new collection with the given name
*
* @param name <p>The name identifying the server, server tab, collection and server console</p>
*/
Collection(String name) {
Collection(String name) throws ConfigurationException {
this.serverTab = new ServerTab(name);
this.server = new Server(name);
this.serverConsole = ServerConsoles.addConsoleTab(name);
@ -31,41 +34,23 @@ public class Collection {
/**
* Creates a new collection with the given parameters
* @param name <p>The name identifying the server, server tab, collection and server console</p>
* @param serverPath <p>The path of the server folder</p>
* @param enabled <p>Whether the server should be run when starting servers</p>
* @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 name <p>The name identifying the server, server tab, collection and server console</p>
* @param serverPath <p>The path of the server folder</p>
* @param enabled <p>Whether the server should be run when starting servers</p>
* @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>
* @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
) {
Collection(String name, String serverPath, boolean enabled, String typeName, String serverVersion, String maxRam,
String vanillaVersion, String snapshotVersion, String spongeVanillaVersion, String bungeeVersion) 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, vanillaVersion,
snapshotVersion, spongeVanillaVersion, bungeeVersion);
this.serverConsole = ServerConsoles.addConsoleTab(name);
this.name = name;
this.serverTab.setData(serverPath, enabled, typeName, serverVersion, maxRam);
@ -73,6 +58,7 @@ public class Collection {
/**
* Gets the name of the collection
*
* @return <p>Collection name</p>
*/
public String getName() {
@ -81,6 +67,7 @@ public class Collection {
/**
* Gets the server of the collection
*
* @return <p>Collection server</p>
*/
public Server getServer() {
@ -89,14 +76,16 @@ public class Collection {
/**
* Gets the server tab of the collection
*
* @return <p>Collection server tab</p>
*/
public ServerTab getServerTab() {
return this.serverTab;
return this.serverTab;
}
/**
* Gets the server console of the collection
*
* @return <p>Collection server console</p>
*/
public Console getServerConsole() {