Notifications
Package: com.hypixel.hytale.server.core.util.NotificationUtil
Toast-style popup notifications with a primary message, secondary message, icon, item display, and style. Notifications are queued and each displays for 5 seconds.
Notification Styles
Section titled “Notification Styles”| Style | Description |
|---|---|
NotificationStyle.Default | Standard notification |
NotificationStyle.Danger | Red/error styling |
NotificationStyle.Warning | Yellow/warning styling |
NotificationStyle.Success | Green/success styling |
Sending Notifications
Section titled “Sending Notifications”All methods on NotificationUtil are public static:
// simple notification to one playerNotificationUtil.sendNotification( playerRef.getPacketHandler(), Message.translation("mymod.item.received"));
// with styleNotificationUtil.sendNotification( playerRef.getPacketHandler(), Message.translation("mymod.error.noPermission"), NotificationStyle.Danger);
// with secondary message and iconNotificationUtil.sendNotification( playerRef.getPacketHandler(), Message.translation("mymod.quest.complete"), Message.translation("mymod.quest.reward"), "Common/UI/Icons/QuestComplete", // icon asset path null, // item (or ItemWithAllMetadata) NotificationStyle.Success);Targeting
Section titled “Targeting”// to all players in a worldNotificationUtil.sendNotificationToWorld( message, null, null, null, NotificationStyle.Default, store);
// to all players on the serverNotificationUtil.sendNotificationToUniverse(message);NotificationUtil.sendNotificationToUniverse(message, NotificationStyle.Warning);The universe-wide methods iterate all worlds and all players within them.
Item Notifications
Section titled “Item Notifications”Notifications can display an item alongside the message:
NotificationUtil.sendNotification( playerRef.getPacketHandler(), Message.translation("mymod.item.crafted"), null, // secondary message null, // icon item, // ItemWithAllMetadata NotificationStyle.Success);This is used internally by the crafting system and objective rewards.
HUD Visibility
Section titled “HUD Visibility”The Notifications component can be toggled per-player via the HUD system:
// hide notification toasts for a playerhud.hideHudComponents(playerRef, HudComponent.Notifications);Packets
Section titled “Packets”See Notification for the wire format.