|
10 | 10 | import java.io.File; |
11 | 11 |
|
12 | 12 | public class UI { |
13 | | - public static void main(String[] args) throws Throwable { |
14 | | - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
| 13 | + public static void main(String[] args) { |
| 14 | + try { |
| 15 | + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
15 | 16 |
|
16 | | - File forgeJar = getFile(new JFileChooser(), "Please select a Forge INSTALLER jar", "You MUST provide a Forge Installer jar...", new JarFilter(), new ZipFilter()); |
| 17 | + File forgeJar = getFile(new JFileChooser(), "Please select a Forge INSTALLER jar", "You MUST provide a Forge Installer jar...", new JarFilter(), new ZipFilter()); |
17 | 18 |
|
18 | | - if (forgeJar != null) { |
19 | | - File multiMcDirectory = getFile(new JFileChooser(), "Please provide your Multi", "You MUST provide a MultiMC install directory", new DirectoryFilter()); |
| 19 | + if (forgeJar != null) { |
| 20 | + File multiMcDirectory = getFile(new JFileChooser(), "Please provide your Multi", "You MUST provide a MultiMC install directory", new DirectoryFilter()); |
20 | 21 |
|
21 | | - if (multiMcDirectory != null) { |
22 | | - File location = Installers.getInstaller(forgeJar).install(multiMcDirectory, forgeJar); |
23 | | - JOptionPane.showMessageDialog(null, "Successfully installed Forge to " + location.getAbsolutePath() + "! Make sure to restart MultiMC if it was already opened", "Success! :)", JOptionPane.PLAIN_MESSAGE); |
| 22 | + if (multiMcDirectory != null) { |
| 23 | + File location = Installers.getInstaller(forgeJar).install(multiMcDirectory, forgeJar); |
| 24 | + JOptionPane.showMessageDialog(null, "Successfully installed Forge to " + location.getAbsolutePath() + "! Make sure to restart MultiMC if it was already opened", "Success! :)", JOptionPane.PLAIN_MESSAGE); |
| 25 | + } |
24 | 26 | } |
| 27 | + } catch (Throwable t) { |
| 28 | + String message = t.getMessage(); |
| 29 | + |
| 30 | + if (message != null) { |
| 31 | + JOptionPane.showMessageDialog(null, message, "An error occurred :(", JOptionPane.ERROR_MESSAGE); |
| 32 | + } |
| 33 | + |
| 34 | + t.printStackTrace(); |
25 | 35 | } |
26 | 36 | } |
27 | 37 |
|
|
0 commit comments