2018-01-18 23:18:45 +01:00
|
|
|
import java.util.ArrayList;
|
|
|
|
public class Server {
|
2018-01-19 00:43:33 +01:00
|
|
|
private static String[17] ramList = {"512M", "1G", "2G", "3G", "4G", "5G", "6G", "7G", "8G", "9G", "10G", "11G", "12G", "13G", "14G", "15G", "16G"};
|
2018-01-18 23:18:45 +01:00
|
|
|
private String name;
|
|
|
|
private String path;
|
|
|
|
private boolean enabled;
|
|
|
|
private ArrayList<String> playerList;
|
|
|
|
private ServerType type;
|
|
|
|
private String serverVersion;
|
2018-01-19 00:43:33 +01:00
|
|
|
private String maxRam;
|
2018-01-18 23:18:45 +01:00
|
|
|
|
|
|
|
public Server(String name) {
|
|
|
|
this.name = name;
|
|
|
|
this.path = "";
|
|
|
|
this.isEnabled = false;
|
|
|
|
this.playerList = new ArrayList<String>();
|
|
|
|
this.type = null;
|
|
|
|
this.serverVersion = null;
|
2018-01-19 00:43:33 +01:00
|
|
|
this.maxRam = ramList[0];
|
2018-01-18 23:18:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void addPlayer(String name) {
|
|
|
|
this.playerList.add(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void removePlayer(String name) {
|
|
|
|
for (int i = 0; i < playerList.size(); i++) {
|
|
|
|
if (name.equals(playerList.get(i))) {
|
|
|
|
playerList.remove(i);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getPath() {
|
|
|
|
return this.path;
|
|
|
|
}
|
|
|
|
|
2018-01-19 00:43:33 +01:00
|
|
|
public String getType() {
|
|
|
|
return this.type.getName() + this.version;
|
2018-01-18 23:18:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isEnabled() {
|
|
|
|
return this.enabled;
|
|
|
|
}
|
|
|
|
|
2018-01-19 00:43:33 +01:00
|
|
|
public String maxRam() {
|
|
|
|
return this.maxRam;
|
|
|
|
}
|
2018-01-18 23:18:45 +01:00
|
|
|
}
|