Kristian Knarvik b662afe0c6 Cleanup and bugfixes
Reformats long lines.
Restructures methods.
Removes some unnecessary methods.
Adds more and better comments.
Checks for illegal characters in collection and profile names.
Profiles.txt saves the profile selected on save.
Adds some methods to avoid code repetition.
Changes the name of at least one method.
I probably forgot to mention something.
2018-02-05 00:00:51 +01:00

70 lines
1.9 KiB
Java

package net.knarcraft.serverlauncher.profile;
import net.knarcraft.serverlauncher.server.Server;
import net.knarcraft.serverlauncher.userinterface.ServerConsoles;
import net.knarcraft.serverlauncher.userinterface.ServerTab;
import net.knarcraft.serverlauncher.userinterface.Console;
/**
* Acts as a wrapper for objects necessary for each server.
*/
public class Collection {
private final Server server;
private final ServerTab serverTab;
private final Console serverConsole;
private final String name;
Collection(String name) {
this.serverTab = new ServerTab(name);
this.server = new Server(name);
this.serverConsole = ServerConsoles.addTab(name);
this.name = name;
}
Collection(String name,
String path,
boolean enabled,
String typeName,
String serverVersion,
String maxRam,
String vanillaVersion,
String snapshotVersion,
String spongeVanillaVersion,
String bungeeVersion
) {
this.serverTab = new ServerTab(name);
this.server = new Server(
name,
path,
enabled,
typeName,
serverVersion,
maxRam,
vanillaVersion,
snapshotVersion,
spongeVanillaVersion,
bungeeVersion
);
this.serverConsole = ServerConsoles.addTab(name);
this.name = name;
this.serverTab.setData(path, enabled, typeName, serverVersion, maxRam);
}
public String getName() {
return this.name;
}
public Server getServer() {
return this.server;
}
public ServerTab getServerTab() {
return this.serverTab;
}
public Console getServerConsole() {
return this.serverConsole;
}
}