Пример #1
0
  public static Advancement importAdv(Advancement advancement) {
    Advancement adv = findByName(advancement.getName());
    if (adv != null) {
      if (Util.isEmpty(advancement.getImgPath())) {
        advancement.setImgPath(adv.getImgPath());
      }
      advancement.setId(adv.getId());

      update(advancement);
    } else {
      if (Util.isEmpty(advancement.getImgPath())) {
        advancement.setImgPath("");
      }

      save(advancement);
    }

    return advancement;
  }
Пример #2
0
  private static boolean deleteAdvancement(String advancementName) {
    if (Util.isEmpty(advancementName)) {
      return true;
    }

    try {
      Statement statement = connector.createStatement();
      statement.executeUpdate(
          "DELETE FROM advancement WHERE name LIKE ('" + advancementName + "')");
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
    return true;
  }