public static boolean downloadMod(String mod, GuiCheckForMods screen) throws IOException { if (Links.hasLocalMod(mod)) { transferFile( mod, Links.getLocalModPath(mod), mod_Beacon.mcDirectory.matches("default") ? ("C:/Users/" + System.getProperty("user.name") + "/AppData/Roaming/.minecraft/mods/1.7.10/") : mod_Beacon.mcDirectory); return true; } else if (Links.hasWebLink(mod)) { downloadFile( mod, Links.getLink(mod), mod_Beacon.mcDirectory.matches("default") ? ("C:/Users/" + System.getProperty("user.name") + "/AppData/Roaming/.minecraft/mods/1.7.10/") : mod_Beacon.mcDirectory, screen); return true; } return false; }
public static List<String> downloadMissingMods( ArrayList<String> missingMods, GuiCheckForMods screen) { List<String> downloadedMods = new ArrayList<String>(); for (String mod : missingMods) { try { if (Links.hasLocalMod(mod)) { transferFile( Links.hasAlias(mod) ? Links.getAlias(mod) : mod, Links.getLocalModPath(mod), mod_Beacon.mcDirectory.matches("default") ? ("C:/Users/" + System.getProperty("user.name") + "/AppData/Roaming/.minecraft/mods/1.7.10/") : mod_Beacon.mcDirectory); downloadedMods.add(mod); } else if (Links.hasWebLink(mod) && hasInternetConnection()) { downloadFile( Links.hasAlias(mod) ? Links.getAlias(mod) : mod, Links.getLink(mod), mod_Beacon.mcDirectory.matches("default") ? ("C:/Users/" + System.getProperty("user.name") + "/AppData/Roaming/.minecraft/mods/1.7.10/") : mod_Beacon.mcDirectory, screen); downloadedMods.add(mod); } else if (!Links.hasLocalMod(mod) && !Links.hasWebLink(mod)) { continue; } } catch (IOException e) { e.printStackTrace(); System.out.println("[Beacon] Catching exception while downloading the '" + mod + "' mod."); continue; } } return downloadedMods; }