Class Toast
java.lang.Object
com.github.darksoulq.abyssallib.world.advancement.Toast
A utility for sending transient "Toast" notifications to players.
This class leverages the advancement packet system to display pop-up messages
in the top-right corner of the screen without adding actual permanent advancements.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionToast(net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component subtitle, org.bukkit.inventory.ItemStack icon, AdvancementFrame frame) Constructs a new Toast notification. -
Method Summary
Modifier and TypeMethodDescriptionstatic Toast.Builderbuilder()Creates a new builder instance for constructing Toasts.voidsend(org.bukkit.entity.Player player) Sends the toast notification to a specific player.
-
Constructor Details
-
Toast
public Toast(net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component subtitle, org.bukkit.inventory.ItemStack icon, AdvancementFrame frame) Constructs a new Toast notification.- Parameters:
title- The primary header text.subtitle- The sub-header text.icon- The icon to display.frame- The visualAdvancementFrame.
-
-
Method Details
-
send
public void send(org.bukkit.entity.Player player) Sends the toast notification to a specific player. This method generates a temporary "fake" advancement, sends completion packets to trigger the UI toast, and schedules a removal packet to clean up the client state.- Parameters:
player- ThePlayerwho should receive the toast.
-
builder
Creates a new builder instance for constructing Toasts.- Returns:
- A new
Toast.Builderinstance.
-