create method

Future<VanillaServer> create (String serverdir, { String version, bool defaultEula: false })

Implementation

static Future<VanillaServer> create(String serverdir, {String version, bool defaultEula = false}) async {

  DartMcLauncherVanillaProperties properties;

  if(!(await new Directory(serverdir).existsSync())
    || !(await new File(path.join(serverdir,"server.properties")).exists())) {
    return await install(serverdir, version: version, eula: defaultEula);
  }
  else if(await new File(path.join(serverdir,"dart-mc-launcher.properties")).exists()) {
    properties = await DartMcLauncherVanillaProperties.loadFile(path.join(serverdir,"dart-mc-launcher.properties"));
  }
  else {
    throw("The server you are trying to load has no \"dart-mc-launcher.properties\" file, for that reason it can't be read by dart-mc-launcher. If you wanna create a new Server at this directory delete all contents, in other case you have to create a file manually");
  }

  return new VanillaServer._init(serverdir, properties, await ServerProperties.loadFile(path.join(serverdir,"server.properties")));
}