Adds comments and refactors several classes
All checks were successful
KnarCraft/Minecraft-Server-Launcher/master This commit looks good

Adds comments to Collection
Makes some variable and function names more descriptive
Adds some new methods for showing messsages and errors
Adds a lot of missing comments
Enhances some existing comments
This commit is contained in:
2020-02-13 21:10:18 +01:00
parent c59cbcefbb
commit 040740db84
11 changed files with 489 additions and 383 deletions

View File

@ -18,15 +18,32 @@ public class Collection {
private final Console serverConsole;
private final String name;
/**
* 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) {
this.serverTab = new ServerTab(name);
this.server = new Server(name);
this.serverConsole = ServerConsoles.addTab(name);
this.serverConsole = ServerConsoles.addConsoleTab(name);
this.name = name;
}
/**
* 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 spongeVanillaVersion <p>The currently selected SpongeVanilla version</p>
* @param bungeeVersion <p>The currently selected Bungee version</p>
*/
Collection(String name,
String path,
String serverPath,
boolean enabled,
String typeName,
String serverVersion,
@ -39,7 +56,7 @@ public class Collection {
this.serverTab = new ServerTab(name);
this.server = new Server(
name,
path,
serverPath,
enabled,
typeName,
serverVersion,
@ -49,23 +66,39 @@ public class Collection {
spongeVanillaVersion,
bungeeVersion
);
this.serverConsole = ServerConsoles.addTab(name);
this.serverConsole = ServerConsoles.addConsoleTab(name);
this.name = name;
this.serverTab.setData(path, enabled, typeName, serverVersion, maxRam);
this.serverTab.setData(serverPath, enabled, typeName, serverVersion, maxRam);
}
/**
* Gets the name of the collection
* @return <p>Collection name</p>
*/
public String getName() {
return this.name;
}
/**
* Gets the server of the collection
* @return <p>Collection server</p>
*/
public Server getServer() {
return this.server;
}
/**
* Gets the server tab of the collection
* @return <p>Collection server tab</p>
*/
public ServerTab getServerTab() {
return this.serverTab;
}
/**
* Gets the server console of the collection
* @return <p>Collection server console</p>
*/
public Console getServerConsole() {
return this.serverConsole;
}