示例#1
0
        @Override
        public void actionPerformed(ActionEvent e) {
          final List<String> choice = list.getSelectedValues();

          if (choice == null) {
            return;
          }

          // OK name

          final String trailS = (choice.size() > 1 ? "s" : "");

          // @formatter:off
          final boolean yes =
              Alerts.askYesNo(
                  DialogManageMcPacks.this,
                  "Deleting Installed Pack" + trailS,
                  "Do you really want to delete the selected\n"
                      + "resource pack"
                      + trailS
                      + " from your Minecraft folder?");
          // @formatter:on

          if (!yes) return;

          for (final String s : choice) {
            final File f = new File(OsUtils.getMcDir("resourcepacks"), s + ".zip");
            f.delete();
          }

          reloadOptions();
        }
示例#2
0
  private List<String> getOptions() {
    final List<File> aList = FileUtils.listDirectory(OsUtils.getMcDir("resourcepacks"));
    final List<String> options = new ArrayList<String>();

    for (final File f : aList) {
      if (f.isDirectory()) continue;
      final String[] parts = FileUtils.getFilenameParts(f);

      if (parts[1].equalsIgnoreCase("zip")) {
        options.add(parts[0]);
      }
    }

    Collections.sort(options);

    return options;
  }