Search in sources :

Example 1 with BungeeGroup

use of de.dytanic.cloudnetcore.util.defaults.BungeeGroup in project CloudNet by Dytanic.

the class CloudConfig method defaultInitDoc.

private void defaultInitDoc(ConsoleReader consoleReader) throws Exception {
    if (Files.exists(servicePath))
        return;
    String hostName = NetworkUtils.getHostName();
    if (hostName.equals("127.0.0.1") || hostName.equalsIgnoreCase("127.0.1.1") || hostName.split("\\.").length != 4) {
        String input;
        System.out.println("Please write the first Wrapper IP address:");
        while ((input = consoleReader.readLine()) != null) {
            if ((input.equals("127.0.0.1") || input.equalsIgnoreCase("127.0.1.1") || input.split("\\.").length != 4)) {
                System.out.println("Please write the real ip address :)");
                continue;
            }
            hostName = input;
            break;
        }
    }
    new Document("wrapper", Arrays.asList(new WrapperMeta("Wrapper-1", hostName, "admin"))).append("proxyGroups", Arrays.asList(new BungeeGroup())).saveAsConfig(servicePath);
    new Document("group", new LobbyGroup()).saveAsConfig(Paths.get("groups/Lobby.json"));
}
Also used : WrapperMeta(de.dytanic.cloudnetcore.network.components.WrapperMeta) BungeeGroup(de.dytanic.cloudnetcore.util.defaults.BungeeGroup) Document(de.dytanic.cloudnet.lib.utility.document.Document) LobbyGroup(de.dytanic.cloudnetcore.util.defaults.LobbyGroup)

Aggregations

Document (de.dytanic.cloudnet.lib.utility.document.Document)1 WrapperMeta (de.dytanic.cloudnetcore.network.components.WrapperMeta)1 BungeeGroup (de.dytanic.cloudnetcore.util.defaults.BungeeGroup)1 LobbyGroup (de.dytanic.cloudnetcore.util.defaults.LobbyGroup)1