Interface Notification
public sealed interface Notification
Is used to send temporary advancements to the client, which are called notifications.
Here is an example of its use:
Here is an example of its use:
Notification notification = Notification.builder()
.frameType(FrameType.TASK)
.title(Component.text("Welcome!"))
.icon(Material.IRON_SWORD).build();
notification.send(player);
The constant IDENTIFIER
is used for the advancement packet
The constant REMOVE_PACKET
is used to remove previous notifications- Since:
- 1.4.1
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull Notification.Builder
builder()
Creates a new builder instance@NotNull ItemStack
icon()
Get the displayed icon of the notification asItemStack
void
send
(@NotNull Collection<@NotNull Player> players) Send the notification to a collection of clientsvoid
Send the notification to the client@NotNull Component
title()
Gets the title of the notification as aComponent
@NotNull FrameType
type()
Get theFrameType
of the notification
-
Field Details
-
IDENTIFIER
- See Also:
-
REMOVE_PACKET
-
-
Method Details
-
builder
Creates a new builder instance- Returns:
- an instance of the builder
-
send
Send the notification to the client- Parameters:
player
- to get be sent
-
send
Send the notification to a collection of clients- Parameters:
players
- to get be sent
-
title
Gets the title of the notification as aComponent
- Returns:
- the title
Component
-
type
Get theFrameType
of the notification- Returns:
- the type
-
icon
Get the displayed icon of the notification asItemStack
- Returns:
- the
ItemStack
-