49 lines
1.9 KiB
Java
49 lines
1.9 KiB
Java
import java.lang.Runtime;
|
|
import java.util.ArrayList;
|
|
import java.net.URL;
|
|
import java.util.Scanner;
|
|
public class Main {
|
|
public ArrayList<Server> servers = new ArrayList<Server>();
|
|
public ArrayList<ServerType> serverTypes = new ArrayList<ServerType>();
|
|
|
|
private final BASEURL = "https://knarcraft.net/Api/Download/bungeeminecraftserverlauncher/jars";
|
|
private final BUKKITURL = BASEURL + "/Bukkit/";
|
|
private final MCPCURL = BASEURL + "/MCPC+/";
|
|
private final SPIGOT = BASEURL + "/Spigot/";
|
|
|
|
public static void main(String[] args) {
|
|
addServerTypes();
|
|
}
|
|
|
|
public static void addServerTypes() {
|
|
serverTypes.add(new ServerType("Vanilla", {"Latest", "1.12", "1.11.2", "1.10.2", "1.9.4", "1.8.9", "1.7.10", "1.6.4", "1.5.2", "1.4.7", "1.3.2", "1.2.5"}));
|
|
serverTypes.add(new ServerType("Snapshot", {"Latest"}));
|
|
serverTypes.add(new ServerType("SpongeVanilla", {"1.11.2", "1.10.2", "1.8.9"}));
|
|
serverTypes.add(new ServerType("Spigot", {"1.12", "1.11.2", "1.10.2", "1.9.4", "1.9", "1.8.8", "1.7.10", "1.6.4", "1.5.2", "1.4.7"}));
|
|
serverTypes.add(new ServerType("MCPCplus", {"1.6.4", "1.6.2", "1.5.2", "1.4.7"}));
|
|
serverTypes.add(new ServerType("Craftbukkit", {"1.12", "1.11.2", "1.10.2", "1.9.4", "1.8.8", "1.7.10", "1.6.4", "1.5.2", "1.4.6", "1.3.2", "1.2.5", "1.1", "1.0"}));
|
|
serverTypes.add(new ServerType("Custom", {""}));
|
|
}
|
|
|
|
public static void startServers() {
|
|
for (Server server : servers) {
|
|
if (server.isEnabled()) {
|
|
String path = server.getPath();
|
|
String type = server.getType();
|
|
String ram = server.maxRam();
|
|
Runtime rt = Runtime.getRuntime();
|
|
Process pr = rt.exec("java -Xmx" + ram + " -Xms512M -jar " + '"' + path + "\\" + type + '" nogui');
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void readFile(String path) {
|
|
try {
|
|
URL url = new URL(path);
|
|
Scanner s = new Scanner(url.openStream());
|
|
System.out.println(s.next());
|
|
} catch (java.io.IOException e) {
|
|
System.out.println(e);
|
|
}
|
|
}
|
|
} |