|
6 | 6 | import javax.swing.JFrame; |
7 | 7 | import javax.swing.JOptionPane; |
8 | 8 |
|
| 9 | +import com.dreammaster.main.MainRegistry; |
9 | 10 | import net.minecraft.client.Minecraft; |
10 | 11 | import net.minecraft.util.StatCollector; |
11 | 12 |
|
@@ -40,28 +41,33 @@ public abstract class MixinMinecraft_ConfirmExit { |
40 | 41 | if (!this.dreamcraft$waitingDialogQuit) { |
41 | 42 | this.dreamcraft$waitingDialogQuit = true; |
42 | 43 | new Thread(() -> { |
43 | | - final JFrame frame = new JFrame(); |
44 | | - frame.setAlwaysOnTop(true); |
45 | | - final URL resource = IconLoader.class.getClassLoader() |
46 | | - .getResource("assets/dreamcraft/textures/icon/GTNH_42x42.png"); |
47 | | - final ImageIcon imageIcon = resource == null ? null : new ImageIcon(resource); |
48 | | - final int result = JOptionPane.showConfirmDialog( |
49 | | - frame, |
50 | | - // When FML encounters an error, the only way to close the window is through the close button, |
51 | | - // which will show this message, unfortunately at this point, no localisations will have been |
52 | | - // loaded, so we add a hardcoded fallback message here. |
53 | | - StatCollector.canTranslate("dreamcraft.gui.quitmessage") |
54 | | - ? StatCollector.translateToLocal("dreamcraft.gui.quitmessage") |
55 | | - : "Are you sure you want to exit the game?", |
56 | | - Refstrings.NAME, |
57 | | - JOptionPane.YES_NO_OPTION, |
58 | | - JOptionPane.QUESTION_MESSAGE, |
59 | | - imageIcon); |
60 | | - if (result == JOptionPane.YES_OPTION) { |
| 44 | + if(MainRegistry.CoreConfig.confirmExit) { |
| 45 | + final JFrame frame = new JFrame(); |
| 46 | + frame.setAlwaysOnTop(true); |
| 47 | + final URL resource = IconLoader.class.getClassLoader() |
| 48 | + .getResource("assets/dreamcraft/textures/icon/GTNH_42x42.png"); |
| 49 | + final ImageIcon imageIcon = resource == null ? null : new ImageIcon(resource); |
| 50 | + final int result = JOptionPane.showConfirmDialog( |
| 51 | + frame, |
| 52 | + // When FML encounters an error, the only way to close the window is through the close button, |
| 53 | + // which will show this message, unfortunately at this point, no localisations will have been |
| 54 | + // loaded, so we add a hardcoded fallback message here. |
| 55 | + StatCollector.canTranslate("dreamcraft.gui.quitmessage") |
| 56 | + ? StatCollector.translateToLocal("dreamcraft.gui.quitmessage") |
| 57 | + : "Are you sure you want to exit the game?", |
| 58 | + Refstrings.NAME, |
| 59 | + JOptionPane.YES_NO_OPTION, |
| 60 | + JOptionPane.QUESTION_MESSAGE, |
| 61 | + imageIcon); |
| 62 | + if (result == JOptionPane.YES_OPTION) { |
| 63 | + this.dreamcraft$isCloseRequested = true; |
| 64 | + this.shutdown(); |
| 65 | + } |
| 66 | + this.dreamcraft$waitingDialogQuit = false; |
| 67 | + } else { |
61 | 68 | this.dreamcraft$isCloseRequested = true; |
62 | 69 | this.shutdown(); |
63 | 70 | } |
64 | | - this.dreamcraft$waitingDialogQuit = false; |
65 | 71 | }).start(); |
66 | 72 | } |
67 | 73 | ci.cancel(); |
|
0 commit comments