forked from HMCL-dev/HMCL
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show a warning message before the application startup.
- Loading branch information
1 parent
882583f
commit d15d6ea
Showing
5 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package net.burningtnt.hmclprs; | ||
|
||
import javafx.scene.control.Alert; | ||
import javafx.scene.control.ButtonType; | ||
|
||
import javax.swing.*; | ||
import java.util.Optional; | ||
|
||
import static org.jackhuang.hmcl.util.i18n.I18n.i18n; | ||
|
||
public final class Hooks { | ||
private Hooks() { | ||
} | ||
|
||
public static void onApplicationLaunch() { | ||
try { | ||
Optional<ButtonType> opt = new Alert(Alert.AlertType.CONFIRMATION, i18n("prs.warning")).showAndWait(); | ||
if (opt.isPresent() && opt.get() == ButtonType.YES) { | ||
return; | ||
} | ||
} catch (Throwable ignored) { | ||
if (JOptionPane.showConfirmDialog( | ||
null, i18n("prs.warning"), i18n("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE | ||
) == JOptionPane.OK_OPTION) { | ||
return; | ||
} | ||
} | ||
System.exit(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters