public boolean editPropertiesFile(String fileName, String type, String key, String value)
     throws FileNotFoundException {
   if ((new File(fileName + ".properties")).exists()) {
     PropertiesFile p = new PropertiesFile(fileName + ".properties");
     if (type.toLowerCase().equals("boolean")) {
       p.setBoolean(key, Boolean.valueOf(value.toString()));
     } else if (type.toLowerCase().equals("long")) {
       p.setLong(key, Long.valueOf(value.toString()));
     } else if (type.toLowerCase().equals("int")) {
       p.setInt(key, Integer.valueOf(value.toString()));
     } else if (type.toLowerCase().equals("string")) {
       p.setString(key, value.toString());
     } else if (type.toLowerCase().equals("double")) {
       p.setDouble(key, Double.valueOf(value.toString()));
     }
     p.save();
     return true;
   } else {
     throw new FileNotFoundException(fileName + ".properties was not found");
   }
 }
  public boolean setWorldTime(String worldName, int time) {
    Server.getWorld(worldName).setTime(Long.valueOf(time));

    return true;
  }
  /** Starts this server. */
  public void start() {
    // Determine console mode and start reading input
    consoleManager.startConsole(config.getBoolean(ServerConfig.Key.USE_JLINE));
    consoleManager.startFile(config.getString(ServerConfig.Key.LOG_FILE));

    if (getProxySupport()) {
      if (getOnlineMode()) {
        logger.warning("Proxy support is enabled, but online mode is enabled.");
      } else {
        logger.info("Proxy support is enabled.");
      }
    } else if (!getOnlineMode()) {
      logger.warning(
          "The server is running in offline mode! Only do this if you know what you're doing.");
    }

    // Load player lists
    opsList.load();
    whitelist.load();
    nameBans.load();
    ipBans.load();

    // DRAGONET-Start
    this.dragonetServer = new DragonetServer(this);
    this.dragonetServer.initialize();
    // DRAGONET-End

    // Start loading plugins
    loadPlugins();
    enablePlugins(PluginLoadOrder.STARTUP);

    // Create worlds
    String name = config.getString(ServerConfig.Key.LEVEL_NAME);
    String seedString = config.getString(ServerConfig.Key.LEVEL_SEED);
    boolean structs = getGenerateStructures();
    WorldType type = WorldType.getByName(getWorldType());
    if (type == null) {
      type = WorldType.NORMAL;
    }

    long seed = new Random().nextLong();
    if (!seedString.isEmpty()) {
      try {
        long parsed = Long.parseLong(seedString);
        if (parsed != 0) {
          seed = parsed;
        }
      } catch (NumberFormatException ex) {
        seed = seedString.hashCode();
      }
    }

    createWorld(
        WorldCreator.name(name)
            .environment(Environment.NORMAL)
            .seed(seed)
            .type(type)
            .generateStructures(structs));
    if (getAllowNether()) {
      createWorld(
          WorldCreator.name(name + "_nether")
              .environment(Environment.NETHER)
              .seed(seed)
              .type(type)
              .generateStructures(structs));
    }
    if (getAllowEnd()) {
      createWorld(
          WorldCreator.name(name + "_the_end")
              .environment(Environment.THE_END)
              .seed(seed)
              .type(type)
              .generateStructures(structs));
    }

    // Finish loading plugins
    enablePlugins(PluginLoadOrder.POSTWORLD);
    commandMap.registerServerAliases();
    scheduler.start();
  }