Hello there SpigotMC Development Community, I'm facing a bit of a problem for a bit of time now with creating servers on the fly via a bungeecord plugin. The problem lays with connection to those created servers, not creation or startup. Here's my method of starting/adding the server to the proxy; Code (Text): public static void startServer(String name, ServerType type, int port) { try { ProcessBuilder builder = new ProcessBuilder("/bin/bash", "-c", "java -Xmx1024M -jar " + "/path/to/servers/" + type.name().toLowerCase() + "/" + name + "/" + type.name().toLowerCase() + ".jar --port " + port); try { Process serverProcess = builder.start(); if (serverProcess.exitValue() == 0) { BufferedReader read = new BufferedReader(new InputStreamReader(serverProcess.getInputStream())); getServerProcessMap().put(name, read.readLine().trim()); } else { throw new Exception("[Server Manager] Failed to retrieve service pid, cancelling..."); } } catch (Exception e) { Bungee.log("[Server Manager] Fatal: " + e.getMessage() + " (" + e.getClass().getName() + ")"); } } catch (Exception e) { Bungee.log("[Server Manager] Fatal: " + e.getMessage() + " (" + e.getClass().getName() + ")"); } } When trying to connect via my proxy that the server was added to (same machine), it refuses with an AnnotatedConnectionException (not online). While starting the server works fine, connection to said server is impossible. (I have opened an independent terminal window and ran the same command, and the server started on the requested port, so not issues there - while the proxy with the server entry was online and connection was still refused). I really have no idea what the problem would be at this time (NOTE: I am copying directories with the server files from a base folder which would ensure the EULA would not interfere with startup, and have made sure the base directory's spigot.yml has bungeecord: true set). Another note: I have yet to verify that the dedicated machine's firewall is the issue, though it should not be due to the fact that all of my other server's ports are blocked, which would make the firewall being the issue doubtful in my eyes, and yes, in my creation method I did verify that the server was added to the bungee server list so that is not the problem. Proposed solutions would be greatly appreciated. Thanks, Mike M
Yes, I'm currently out and can't grab what I did, but I will do so tomorrow. Thanks, @Voone, for the reply.
@Voone alrighty, I'm home now and this is what I did to construct the server info to insert into the proxy: Code (Text): public static void addServer(String name, InetSocketAddress port, String motd, boolean restricted) { try { BungeeCord cord = BungeeCord.getInstance(); ServerInfo info = new BungeeServerInfo(name, port, motd, restricted); cord.getServers().put(name, info); } catch (Exception e) { Bungee.log("[Server Manager] Failed to add server: " + e.getMessage() + " (" + e.getClass().getName() + ")"); } } This has always worked for me in the past, so I've continually used this.