@@ -89,7 +89,7 @@ private static void create() {
8989 System .out .println (Ansi .ansi ().fg (Ansi .Color .CYAN ).a ("The slug of the profile is " ).a (profile .getName ()));
9090 } catch (Exception e ) {
9191 System .err .println (Ansi .ansi ().fg (Ansi .Color .RED ).a ("Failed to create profile " + profile ));
92- e .printStackTrace ();
92+ if (! Config . silentExceptions ) e .printStackTrace ();
9393 }
9494 }
9595
@@ -104,7 +104,7 @@ private static void edit(String profile) {
104104 json = (JSONObject ) parser .parse (new FileReader (config ));
105105 } catch (IOException | ParseException e ) {
106106 System .err .println (Ansi .ansi ().fg (Ansi .Color .RED ).a ("Cannot read config of profile " + profile ));
107- e .printStackTrace ();
107+ if (! Config . silentExceptions ) e .printStackTrace ();
108108 return ;
109109 }
110110 String name = (String ) json .getOrDefault ("name" , "" );
@@ -155,7 +155,7 @@ private static void edit(String profile) {
155155 System .out .println (Ansi .ansi ().fg (Ansi .Color .GREEN ).a ("Edited profile " + profile ));
156156 } catch (Exception e ) {
157157 System .err .println (Ansi .ansi ().fg (Ansi .Color .RED ).a ("Failed to edit profile " + profile ));
158- e .printStackTrace ();
158+ if (! Config . silentExceptions ) e .printStackTrace ();
159159 }
160160 }
161161
@@ -167,7 +167,7 @@ private static void delete(String[] names) {
167167 if (!profiles .contains (name )) throw new NoSuchObjectException ("Cannot find profile with name " + name );
168168 folders .add (name );
169169 } catch (Exception e ) {
170- e .printStackTrace ();
170+ if (! Config . silentExceptions ) e .printStackTrace ();
171171 }
172172 }
173173 if (folders .size () < 1 ) {
@@ -189,7 +189,7 @@ private static void delete(String[] names) {
189189 try {
190190 FileUtils .deleteDirectory (new File (Config .profileDir .getAbsolutePath () + File .separator + s ));
191191 } catch (Exception e ) {
192- e .printStackTrace ();
192+ if (! Config . silentExceptions ) e .printStackTrace ();
193193 failed .getAndIncrement ();
194194 }
195195 });
@@ -212,7 +212,7 @@ private static void add(String[] ids) {
212212 try {
213213 config = (JSONObject ) parser .parse (new FileReader (profileConfig ));
214214 } catch (ParseException | IOException e ) {
215- e .printStackTrace ();
215+ if (! Config . silentExceptions ) e .printStackTrace ();
216216 return ;
217217 }
218218 File modsFolder = new File (Config .profileDir .getAbsolutePath () + File .separator + profile + File .separator + "mods" );
@@ -253,7 +253,7 @@ private static void add(String[] ids) {
253253 String loc = Utils .downloadFile (downloadUrl , modsFolder .getAbsolutePath (), ((String ) bestFile .get ("fileName" )).replace (".jar" , "_" + id + "_" + bestFile .get ("id" ) + ".jar" ));
254254 System .out .println (Ansi .ansi ().fg (Ansi .Color .GREEN ).a ("Downloaded " + loc ));
255255 } catch (Exception e ) {
256- e .printStackTrace ();
256+ if (! Config . silentExceptions ) e .printStackTrace ();
257257 }
258258 }
259259 System .out .println (Ansi .ansi ().fg (Ansi .Color .YELLOW ).a ("Finished all mod downloads." ));
@@ -288,7 +288,7 @@ private static void remove(String[] ids) {
288288 }
289289 files .put (name + ".jar" , modName );
290290 } catch (Exception e ) {
291- e .printStackTrace ();
291+ if (! Config . silentExceptions ) e .printStackTrace ();
292292 }
293293 }
294294 if (files .size () < 1 ) {
@@ -310,7 +310,7 @@ private static void remove(String[] ids) {
310310 try {
311311 new File (Config .profileDir + File .separator + profile + File .separator + "mods" + File .separator + key ).delete ();
312312 } catch (Exception e ) {
313- e .printStackTrace ();
313+ if (! Config . silentExceptions ) e .printStackTrace ();
314314 failed .getAndIncrement ();
315315 }
316316 });
@@ -332,15 +332,15 @@ private static void export(String[] args) {
332332 try {
333333 config = (JSONObject ) parser .parse (new FileReader (profileConfig ));
334334 } catch (ParseException | IOException e ) {
335- e .printStackTrace ();
335+ if (! Config . silentExceptions ) e .printStackTrace ();
336336 return ;
337337 }
338338 File modsFolder = new File (Config .profileDir .getAbsolutePath () + File .separator + profile + File .separator + "mods" );
339339 File modsCopy = new File (modsFolder .getParent () + File .separator + "mods_copy" );
340340 try {
341341 FileUtils .copyDirectory (modsFolder , modsCopy );
342342 } catch (Exception e ) {
343- e .printStackTrace ();
343+ if (! Config . silentExceptions ) e .printStackTrace ();
344344 return ;
345345 }
346346 Map <Integer , Map .Entry <Integer , String >> mods = Config .loadMods (profile );
@@ -382,7 +382,7 @@ private static void export(String[] args) {
382382 pw .close ();
383383 } catch (Exception e ) {
384384 System .err .println (Ansi .ansi ().fg (Ansi .Color .RED ).a ("Failed to create manifest.json." ));
385- e .printStackTrace ();
385+ if (! Config . silentExceptions ) e .printStackTrace ();
386386 return ;
387387 }
388388 List <String > overridesDir = new ArrayList <>(), overridesFile = new ArrayList <>();
@@ -409,7 +409,7 @@ private static void export(String[] args) {
409409 }
410410 } catch (Exception e ) {
411411 System .out .println (Ansi .ansi ().fg (Ansi .Color .RED ).a ("Failed to copy files to overrides." ));
412- e .printStackTrace ();
412+ if (! Config . silentExceptions ) e .printStackTrace ();
413413 return ;
414414 }
415415 String zipName = config .get ("name" ) + "-" + version + ".zip" ;
@@ -423,7 +423,7 @@ private static void export(String[] args) {
423423 fos .close ();
424424 } catch (Exception e ) {
425425 System .out .println (Ansi .ansi ().fg (Ansi .Color .RED ).a ("Failed to zip everything." ));
426- e .printStackTrace ();
426+ if (! Config . silentExceptions ) e .printStackTrace ();
427427 return ;
428428 }
429429 try {
@@ -432,7 +432,7 @@ private static void export(String[] args) {
432432 FileUtils .deleteDirectory (modsCopy );
433433 } catch (Exception e ) {
434434 System .out .println (Ansi .ansi ().fg (Ansi .Color .YELLOW ).a ("Failed to clean up, but we can keep running." ));
435- e .printStackTrace ();
435+ if (! Config . silentExceptions ) e .printStackTrace ();
436436 }
437437 System .out .println (Ansi .ansi ().fg (Ansi .Color .GREEN ).a ("Exported profile " + profile + " to " + zipName ));
438438 }
@@ -452,7 +452,7 @@ private static void update(String[] args) {
452452 try {
453453 config = (JSONObject ) parser .parse (new FileReader (profileConfig ));
454454 } catch (ParseException | IOException e ) {
455- e .printStackTrace ();
455+ if (! Config . silentExceptions ) e .printStackTrace ();
456456 return ;
457457 }
458458 Map <Integer , Map .Entry <Integer , String >> mods = Config .loadMods (profile );
@@ -488,7 +488,7 @@ private static void update(String[] args) {
488488 }
489489 } catch (Exception e ) {
490490 System .out .println (Ansi .ansi ().fg (Ansi .Color .RED ).a ("Having trouble with mod " + entry .getKey ()));
491- e .printStackTrace ();
491+ if (! Config . silentExceptions ) e .printStackTrace ();
492492 }
493493 }
494494 if (!doUpdate ) {
@@ -503,7 +503,7 @@ private static void update(String[] args) {
503503 pw .close ();
504504 System .out .println (Ansi .ansi ().fg (Ansi .Color .GREEN ).a ("Exported mods with update available to mod_updates.txt" ));
505505 } catch (Exception e ) {
506- e .printStackTrace ();
506+ if (! Config . silentExceptions ) e .printStackTrace ();
507507 }
508508 }
509509 return ;
@@ -553,16 +553,16 @@ private static void update(String[] args) {
553553 System .out .println (Ansi .ansi ().fg (Ansi .Color .GREEN ).a ("Downloaded " + loc ));
554554 }
555555 } catch (Exception e ) {
556- e .printStackTrace ();
556+ if (! Config . silentExceptions ) e .printStackTrace ();
557557 }
558558 }
559559 }
560560
561561 private static void importProf (String [] paths ) {
562- importProf (paths , false , false );
562+ importProf (paths , false );
563563 }
564564
565- private static boolean importProf (String [] paths , boolean silent , boolean toCD ) {
565+ private static boolean importProf (String [] paths , boolean toCD ) {
566566 if (toCD && paths .length > 1 ) return false ;
567567 boolean imported = false ;
568568 for (String path : paths ) {
@@ -620,7 +620,7 @@ private static boolean importProf(String[] paths, boolean silent, boolean toCD)
620620 System .out .println (Ansi .ansi ().fg (Ansi .Color .GREEN ).a ("Converted modpack " + slug + " into profile." ));
621621 imported = true ;
622622 } catch (Exception e ) {
623- if (!silent ) e .printStackTrace ();
623+ if (!Config . silentExceptions ) e .printStackTrace ();
624624 }
625625 try {
626626 if (Config .tempDir .exists () && Config .tempDir .isDirectory ()) FileUtils .deleteDirectory (Config .tempDir );
@@ -633,7 +633,7 @@ private static boolean importProf(String[] paths, boolean silent, boolean toCD)
633633 public static boolean findAndImport () {
634634 try {
635635 File currentDir = new File (Constants .ABSOLUTE_PATH );
636- return importProf (currentDir .list ((dir , name ) -> name .endsWith (".zip" )), true , true );
636+ return importProf (currentDir .list ((dir , name ) -> name .endsWith (".zip" )), true );
637637 } catch (Exception ignored ) {
638638 }
639639 return false ;
0 commit comments