diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/NotifyCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/NotifyCommand.java index bf14beeb..9b30e9ed 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/NotifyCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/NotifyCommand.java @@ -13,7 +13,7 @@ public NotifyCommand(LaunchServer server) { @Override public String getArgsDescription() { - return "[head] [message]"; + return "[head] [message] (icon)"; } @Override @@ -24,7 +24,12 @@ public String getUsageDescription() { @Override public void invoke(String... args) throws Exception { verifyArgs(args, 2); - NotificationEvent event = new NotificationEvent(args[0], args[1]); + NotificationEvent event; + if(args.length < 3) { + event = new NotificationEvent(args[0], args[1]); + } else { + event = new NotificationEvent(args[0], args[1], Enum.valueOf(NotificationEvent.NotificationType.class, args[2])); + } WebSocketService service = server.nettyServerSocketHandler.nettyServer.service; service.sendObjectAll(event, WebSocketEvent.class); } diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/events/NotificationEvent.java b/LauncherAPI/src/main/java/pro/gravit/launcher/events/NotificationEvent.java index cdf124cb..a5fef64b 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/events/NotificationEvent.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/events/NotificationEvent.java @@ -8,14 +8,27 @@ public class NotificationEvent implements WebSocketEvent { public final String head; @LauncherNetworkAPI public final String message; + @LauncherNetworkAPI + public final NotificationType icon; public NotificationEvent(String head, String message) { this.head = head; this.message = message; + this.icon = NotificationType.INFO; + } + + public NotificationEvent(String head, String message, NotificationType icon) { + this.head = head; + this.message = message; + this.icon = icon; } @Override public String getType() { return "notification"; } + + public enum NotificationType { + INFO, WARN, ERROR, OTHER + } }