50 lines
1.1 KiB
Java
50 lines
1.1 KiB
Java
import java.util.ArrayList;
|
|
public class Server {
|
|
private static String[17] ramList = {"512M", "1G", "2G", "3G", "4G", "5G", "6G", "7G", "8G", "9G", "10G", "11G", "12G", "13G", "14G", "15G", "16G"};
|
|
private String name;
|
|
private String path;
|
|
private boolean enabled;
|
|
private ArrayList<String> playerList;
|
|
private ServerType type;
|
|
private String serverVersion;
|
|
private String maxRam;
|
|
|
|
public Server(String name) {
|
|
this.name = name;
|
|
this.path = "";
|
|
this.isEnabled = false;
|
|
this.playerList = new ArrayList<String>();
|
|
this.type = null;
|
|
this.serverVersion = null;
|
|
this.maxRam = ramList[0];
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
public String getType() {
|
|
return this.type.getName() + this.version;
|
|
}
|
|
|
|
public boolean isEnabled() {
|
|
return this.enabled;
|
|
}
|
|
|
|
public String maxRam() {
|
|
return this.maxRam;
|
|
}
|
|
} |