Exemple #1
0
  /**
   * Writes configuration.
   *
   * @param writeType write type
   * @throws IOException when write fails
   */
  public static void writeProfessionConfig(ProfessionConfiguration config, WriteReadType writeType)
      throws IOException {

    GsonBuilder gsonBuilder = new GsonBuilder();
    gsonBuilder.registerTypeAdapter(Ability.class, new AbilityDeserializer());
    Gson gson = gsonBuilder.create();
    writeConfig(gson.toJson(config), writeType, ConfigType.PROFESSION.getFileName());
  }
Exemple #2
0
  /**
   * Reads configuration.
   *
   * @return configuration
   * @throws JsonSyntaxException when parse fails
   * @throws IOException when read fails
   */
  public static ProfessionConfiguration readProfessionConfig()
      throws JsonParseException, IOException {

    Gson gson = new Gson();
    return gson.fromJson(
        readConfig(WriteReadType.NORMAL, ConfigType.PROFESSION.getFileName()).toString(),
        ProfessionConfiguration.class);
  }