Tabnine Logo
Arguments
Code IndexAdd Tabnine to your IDE (free)

How to use
Arguments
in
com.nincraft.modpackdownloader.util

Best Java code snippets using com.nincraft.modpackdownloader.util.Arguments (Showing top 17 results out of 315)

origin: Nincraft/ModPackDownloader

  private JCommander initArguments(final String[] args) {
    // Initialize application arguments
    arguments = new Arguments();
    return new JCommander(arguments, null, args);
  }
}
origin: Nincraft/ModPackDownloader

private boolean noProcessArgsSupplied(Arguments arguments) {
  return !arguments.isDownloadMods() && !arguments.isUpdateMods() && !arguments.isMergeManifests()
      && StringUtils.isBlank(arguments.getCheckMCUpdate());
}
origin: Nincraft/ModPackDownloader

private void defaultArguments(Arguments arguments) {
  if (CollectionUtils.isEmpty(arguments.getManifests())) {
    log.debug("No manifest supplied, using default {}", reference.getDefaultManifestFile());
    arguments.setManifests(Lists.newArrayList(new File(reference.getDefaultManifestFile())));
  }
  if (Strings.isNullOrEmpty(arguments.getModFolder())) {
    log.debug("No output folder supplied, using default \"mods\"");
    arguments.setModFolder("mods");
  }
  if (noProcessArgsSupplied(arguments)) {
    arguments.setDownloadMods(true);
  }
}
origin: Nincraft/ModPackDownloader

private boolean shouldProcessUpdate(Arguments arguments) {
  return arguments.isUpdateMods() || !StringUtils.isBlank(arguments.getCheckMCUpdate());
}
origin: Nincraft/ModPackDownloader

boolean returnStatus;
log.trace("Updating Curse modpack");
String modPackIdName = arguments.getUpdateCurseModPack();
int fileId = 0;
if (NumberUtils.isParsable(arguments.getCurseFileId())) {
  fileId = Integer.parseInt(arguments.getCurseFileId());
CurseModpackFile modPack = new CurseModpackFile(modPackId, modPackName, fileId);
modPack.init();
arguments.setMcVersion("*");
curseFileHandler.updateCurseFile(modPack);
arguments.setModFolder(".");
modPack.setDownloadUrl(modPack.getCurseForgeDownloadUrl());
getDownloadUrl(modPack);
arguments.setModFolder("mods");
File modsFolder = new File(arguments.getModFolder());
File backupModsFolder = new File("backupmods");
if (backupModsFolder(modsFolder, backupModsFolder)) {
origin: Nincraft/ModPackDownloader

@Override
protected boolean preprocess(final Entry<File, Manifest> manifestEntry) {
  if (!isCheckUpdate()) {
    backupManifest(manifestEntry.getKey(), manifestEntry.getValue());
  } else {
    arguments.setMcVersion(arguments.getCheckMCUpdate());
  }
  return true;
}
origin: Nincraft/ModPackDownloader

private void downloadModpack(Arguments arguments) throws InterruptedException {
  if (StringUtils.isNotBlank(arguments.getUpdateCurseModPack())) {
    new DownloadModpackProcessor(arguments, downloadHelper).process();
    arguments.setDownloadMods(true);
  }
}
origin: Nincraft/ModPackDownloader

boolean backup = true;
if (Strings.isNullOrEmpty(mcVersion)) {
  mcVersion = arguments.getMcVersion();
  backup = false;
  if (CollectionUtils.isEmpty(arguments.getBackupVersions())) {
    log.debug("No files found for Minecraft {}, disabling download of {}", mcVersion, curseFile.getName());
    curseFile.setSkipDownload(true);
origin: Nincraft/ModPackDownloader

if (FileSystemHelper.getDownloadedFile(decodedFileName, downloadableFile.getFolder()).exists() && !arguments.isForceDownload()) {
  log.debug("Found {} already downloaded, skipping", decodedFileName);
  return notifyStatus(DownloadStatus.SKIPPED);
if (!FileSystemHelper.isInLocalRepo(downloadableFile.getName(), decodedFileName) || arguments.isForceDownload()) {
  val downloadedFile = FileSystemHelper.getLocalFile(downloadableFile);
  try {
  status = DownloadStatus.SUCCESS_CACHE;
FileSystemHelper.moveFromLocalRepo(downloadableFile, decodedFileName, downloadToLocalRepo, arguments.getModFolder());
log.info("Successfully {} {}", status, downloadableFile.getFileName());
return notifyStatus(status);
origin: Nincraft/ModPackDownloader

  private void checkPastForgeVersion() {
    if (new File(".").getAbsolutePath().contains("MultiMC")) {
      JSONObject currentJson;
      JSONObject multiMCJson;
      try {
        currentJson = (JSONObject) new JSONParser().parse(new FileReader(arguments.getManifests().get(0)));
        multiMCJson = (JSONObject) new JSONParser().parse(new FileReader("../patches/net.minecraftforge.json"));
      } catch (IOException | ParseException e) {
        log.error(e);
        return;
      }
      Manifest currentManifestFile = gson.fromJson(currentJson.toString(), Manifest.class);
      String manifestForge = currentManifestFile.getForgeVersion();
      String multiMCForge = (String) multiMCJson.get("version");
      if (!manifestForge.contains(multiMCForge)) {
        log.error(
            "Current MultiMC Forge version is not the same as the current downloaded pack, please update this instance's Forge to {}",
            manifestForge);
        System.exit(1);
      }
    }
  }
}
origin: Nincraft/ModPackDownloader

public UpdateModsProcessor(Arguments arguments, DownloadHelper downloadHelper) {
  super(arguments, downloadHelper);
  checkUpdate = !StringUtils.isBlank(arguments.getCheckMCUpdate());
}
origin: Nincraft/ModPackDownloader

private void downloadMods(final Manifest manifest) {
  setExecutorService(Executors.newFixedThreadPool(arguments.getMaxDownloadThreads() > 0 ? arguments.getMaxDownloadThreads() : modList.size() + 1));
  ForgeHandler forgeHandler = new ForgeHandler(arguments, downloadHelper);
  Runnable forgeThread = new Thread(() -> forgeHandler.downloadForge(manifest.getMinecraftVersion(), manifest.getMinecraft().getModLoaders()));
  getExecutorService().execute(forgeThread);
  log.trace("Downloading {} mods...", modList.size());
  int downloadCount = 1;
  for (val mod : modList) {
    log.debug(reference.getDownloadingModXOfY(), mod.getName(), downloadCount++,
        Reference.downloadTotal);
    Runnable modDownload = new Thread(() -> {
      modHandlerHashMap.get(mod.getClass()).downloadMod(mod);
      Reference.downloadCount++;
      log.trace("Finished downloading {}", mod.getName());
    });
    getExecutorService().execute(modDownload);
  }
  getExecutorService().shutdown();
  log.trace("Finished downloading {} mods.", modList.size());
}
origin: Nincraft/ModPackDownloader

private CurseFile checkBackupVersions(String releaseType, CurseFile curseFile, JSONObject fileListJson, String mcVersion, CurseFile newMod) {
  CurseFile returnMod = newMod;
  for (String backupVersion : arguments.getBackupVersions()) {
    log.debug("No files found for Minecraft {}, checking backup version {}", mcVersion, backupVersion);
    returnMod = getLatestVersion(releaseType, curseFile, fileListJson, backupVersion);
    if (BooleanUtils.isFalse(newMod.getSkipDownload())) {
      curseFile.setSkipDownload(null);
      log.debug("Found update for {} in Minecraft {}", curseFile.getName(), backupVersion);
      break;
    }
  }
  return returnMod;
}
origin: Nincraft/ModPackDownloader

public void updateCurseFile(final CurseFile curseFile) {
  if (BooleanUtils.isTrue(curseFile.getSkipUpdate())) {
    log.debug("Skipped updating {}", curseFile.getName());
    return;
  }
  disableCertValidation();
  JSONObject fileListJson = new JSONObject();
  try {
    val conn = (HttpURLConnection) new URL(curseFile.getProjectUrl()).openConnection();
    conn.setInstanceFollowRedirects(false);
    conn.connect();
    fileListJson.put("curse", getCurseProjectJson(curseFile).get("files"));
    if (fileListJson.get("curse") == null) {
      log.error("No file list found for {}, and will be skipped.", curseFile.getName());
      return;
    }
  } catch (IOException | ParseException e) {
    log.error(e);
    return;
  }
  val newMod = getLatestVersion(curseFile.getReleaseType() != null ? curseFile.getReleaseType() : arguments.getReleaseType(), curseFile, fileListJson, null);
  if (curseFile.getFileID().compareTo(newMod.getFileID()) < 0) {
    log.debug("Update found for {}.  Most recent version is {}.", curseFile.getName(), newMod.getVersion());
    updateCurseFile(curseFile, newMod);
    updateCheckSummarizer.getModList().add(curseFile);
  }
}
origin: Nincraft/ModPackDownloader

List<Mod> buildModList(final File file, final Manifest manifest) {
  log.trace("Building Mod List...");
  val modList = new ArrayList<Mod>();
  if (manifest.getMinecraftVersion() != null && StringUtils.isBlank(arguments.getCheckMCUpdate())) {
    arguments.setMcVersion(manifest.getMinecraftVersion());
  }
  modList.addAll(manifest.getCurseFiles());
  modList.addAll(manifest.getThirdParty());
  val modSet = new HashSet<Mod>();
  modSet.addAll(modList);
  modList.clear();
  modList.addAll(modSet);
  modList.forEach(Mod::init);
  modList.sort(modComparator);
  log.trace("Finished Building Mod List.");
  return modList;
}
origin: Nincraft/ModPackDownloader

AbstractProcessor(Arguments arguments, DownloadHelper downloadHelper) {
  modHandlerHashMap.put(CurseFile.class, new CurseFileHandler(arguments, downloadHelper));
  modHandlerHashMap.put(ThirdParty.class, new ThirdPartyModHandler(downloadHelper));
  this.arguments = arguments;
  this.downloadHelper = downloadHelper;
  buildManifestList(arguments.getManifests());
}
origin: Nincraft/ModPackDownloader

/**
 * Initializes arguments and jCommander
 *
 * @param args String[] of arguments for execution. See {@link Arguments} for all current parameters
 */
public ModpackDownloaderManager(String[] args){
  arguments = new Arguments();
  jCommander = initArguments(args);
}
com.nincraft.modpackdownloader.utilArguments

Most used methods

  • <init>
  • getBackupVersions
  • getCheckMCUpdate
  • getCurseFileId
  • getManifests
  • getMaxDownloadThreads
  • getMcVersion
  • getModFolder
  • getReleaseType
  • getUpdateCurseModPack
  • isClearCache
  • isDownloadMods
  • isClearCache,
  • isDownloadMods,
  • isForceDownload,
  • isHelpEnabled,
  • isMergeManifests,
  • isUpdateApp,
  • isUpdateForge,
  • isUpdateMods,
  • setDownloadMods,
  • setManifests

Popular in Java

  • Finding current android device location
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setScale (BigDecimal)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Collectors (java.util.stream)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now