Esempio n. 1
0
  public static boolean load() {
    Factions.log("Loading conf from disk");

    if (!file.exists()) {
      Factions.log("No conf to load from disk. Creating new file.");
      save();
      return true;
    }

    try {
      Factions.gson.fromJson(DiscUtil.read(file), Conf.class);
    } catch (Exception e) {
      e.printStackTrace();
      Factions.log("Failed to load the config from disk.");
      return false;
    }

    return true;
  }
Esempio n. 2
0
  public static boolean save() {
    // Factions.log("Saving config to disk.");

    try {
      DiscUtil.write(file, Factions.gson.toJson(new Conf()));
    } catch (Exception e) {
      e.printStackTrace();
      Factions.log("Failed to save the config to disk.");
      return false;
    }
    return true;
  }