diff options
author | bowser0000 <bowser0000@gmail.com> | 2022-04-28 02:22:49 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2022-04-28 02:22:49 -0400 |
commit | b7a2bc13f61a60c99ce460d08d7c89d06ee72a34 (patch) | |
tree | 72d2927c61ee8daabd9eba50eac95e681190e1c3 /src/main/java/me/Danker/utils/Utils.java | |
parent | 852777345060b09ab34945cff65a095aa8cb1aa9 (diff) | |
download | SkyblockMod-b7a2bc13f61a60c99ce460d08d7c89d06ee72a34.tar.gz SkyblockMod-b7a2bc13f61a60c99ce460d08d7c89d06ee72a34.tar.bz2 SkyblockMod-b7a2bc13f61a60c99ce460d08d7c89d06ee72a34.zip |
Add regex for alerts
Capture support using $$x$$ where x is a group number
Make util function for desktop notifications
Diffstat (limited to 'src/main/java/me/Danker/utils/Utils.java')
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 2229d65..3cef436 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -19,7 +19,9 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.*; +import java.awt.*; import java.util.*; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -492,6 +494,21 @@ public class Utils { return (Math.floor(level / 2D) + 25) / 100D; } + public static void desktopNotification(String name, String title, String text, TrayIcon.MessageType messageType) { + try { + final SystemTray tray = SystemTray.getSystemTray(); + final Image image = Toolkit.getDefaultToolkit().createImage("icon.png"); + final TrayIcon trayIcon = new TrayIcon(image, name); + trayIcon.setImageAutoSize(true); + trayIcon.setToolTip(name); + tray.add(trayIcon); + trayIcon.displayMessage(title, text, messageType); + tray.remove(trayIcon); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + public enum DungeonFloor { NONE, E0, |