diff options
| author | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-08-09 07:02:36 +1000 |
|---|---|---|
| committer | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-08-09 07:02:36 +1000 |
| commit | f729d5199a2acd9264f9e4244d598debdc53cbcc (patch) | |
| tree | bbc3d3017c5283174eb55a1300ce4e26bf52e5ec /src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java | |
| parent | 1b2b38531242d2f3862f5594199bd55d0bf00539 (diff) | |
| download | notenoughupdates-f729d5199a2acd9264f9e4244d598debdc53cbcc.tar.gz notenoughupdates-f729d5199a2acd9264f9e4244d598debdc53cbcc.tar.bz2 notenoughupdates-f729d5199a2acd9264f9e4244d598debdc53cbcc.zip | |
1.1.1
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 30dc12c4..3a84dc5c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -368,12 +368,13 @@ public class NEUManager { */ public void loadItemInformation() { Thread thread = new Thread(() -> { + JDialog dialog = null; try { if(config.autoupdate.value) { JOptionPane pane = new JOptionPane("Getting items to download from remote repository."); - JDialog dialog = pane.createDialog("NotEnoughUpdates Remote Sync"); + dialog = pane.createDialog("NotEnoughUpdates Remote Sync"); dialog.setModal(false); - //dialog.setVisible(true); + if(config.dev.value) dialog.setVisible(true); if (Display.isActive()) dialog.toFront(); @@ -389,6 +390,7 @@ public class NEUManager { } catch (IOException e) { } } else { + dialog.setVisible(false); return; } @@ -411,7 +413,7 @@ public class NEUManager { for (String name : changedFiles.keySet()) { pane.setMessage(startMessage + (++downloaded) + "/" + changedFiles.size() + ")\nCurrent: " + name); dialog.pack(); - //dialog.setVisible(true); + if(config.dev.value) dialog.setVisible(true); if (Display.isActive()) dialog.toFront(); File item = new File(repoLocation, name); @@ -440,6 +442,7 @@ public class NEUManager { try { writeJson(itemShaConfig, itemShaLocation); } catch (IOException e) { + e.printStackTrace(); } } else { Utils.recursiveDelete(repoLocation); @@ -450,7 +453,7 @@ public class NEUManager { pane.setMessage("Downloading NEU Master Archive. (DL# >20)"); dialog.pack(); - //dialog.setVisible(true); + if(config.dev.value) dialog.setVisible(true); if (Display.isActive()) dialog.toFront(); File itemsZip = new File(repoLocation, "neu-items-master.zip"); @@ -471,6 +474,7 @@ public class NEUManager { fileOutputStream.write(dataBuffer, 0, bytesRead); } } catch (IOException e) { + dialog.dispose(); return; } @@ -492,10 +496,12 @@ public class NEUManager { } } } - - dialog.dispose(); } - } catch(Exception e) {} + } catch(Exception e) { + e.printStackTrace(); + } finally { + if(dialog != null) dialog.dispose(); + } File items = new File(repoLocation, "items"); if(items.exists()) { |
