Skip to content

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.

StyleDescription
NotificationStyle.DefaultStandard notification
NotificationStyle.DangerRed/error styling
NotificationStyle.WarningYellow/warning styling
NotificationStyle.SuccessGreen/success styling

All methods on NotificationUtil are public static:

// simple notification to one player
NotificationUtil.sendNotification(
playerRef.getPacketHandler(),
Message.translation("mymod.item.received")
);
// with style
NotificationUtil.sendNotification(
playerRef.getPacketHandler(),
Message.translation("mymod.error.noPermission"),
NotificationStyle.Danger
);
// with secondary message and icon
NotificationUtil.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
);
// to all players in a world
NotificationUtil.sendNotificationToWorld(
message, null, null, null, NotificationStyle.Default, store
);
// to all players on the server
NotificationUtil.sendNotificationToUniverse(message);
NotificationUtil.sendNotificationToUniverse(message, NotificationStyle.Warning);

The universe-wide methods iterate all worlds and all players within them.

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.

The Notifications component can be toggled per-player via the HUD system:

// hide notification toasts for a player
hud.hideHudComponents(playerRef, HudComponent.Notifications);

See Notification for the wire format.

Event Titles | Kill Feed | Custom HUD | HUD Components