Class Toast

java.lang.Object
com.ultikits.ultitools.widgets.Toast

public class Toast extends Object
A Minecraft advancement toast notification widget.

Creates temporary advancement toast notifications that appear in the top-right corner of the player's screen. Uses dynamic advancement creation and auto-cleanup.

Example Usage:


 // Display a goal-style toast
 Toast.displayTo(player, "diamond", "You found a diamond!", Toast.Style.GOAL);

 // Display a task-style toast
 Toast.displayTo(player, "emerald", "Trade completed!", Toast.Style.TASK);

 // Multi-line message using | separator
 Toast.displayTo(player, "gold_ingot", "Welcome!|Enjoy your stay!", Toast.Style.CHALLENGE);
 

Toast Styles:

Since:
6.0.0
Author:
wisdomme
  • Field Details

    • key

      private final org.bukkit.NamespacedKey key
      Unique key for this advancement, auto-generated UUID
    • icon

      private final String icon
      The Minecraft item ID for the icon (without "minecraft:" prefix)
    • message

      private final String message
      The toast message, use "|" for line breaks
    • style

      private final Toast.Style style
      The visual style of the toast
  • Constructor Details

  • Method Details

    • start

      private void start(org.bukkit.entity.Player player)
    • createAdvancement

      private void createAdvancement()
    • grantAdvancement

      private void grantAdvancement(org.bukkit.entity.Player player)
    • revokeAdvancement

      private void revokeAdvancement(org.bukkit.entity.Player player)
    • displayTo

      public static void displayTo(org.bukkit.entity.Player player, String icon, String message, Toast.Style style)
      Displays a toast notification to the specified player.

      The toast will automatically be revoked after 10 ticks (0.5 seconds) to clean up the temporary advancement.

      Parameters:
      player - the target player
      icon - the Minecraft item ID for the icon (e.g., "diamond", "emerald")
      message - the toast message, use "|" for line breaks
      style - the visual style of the toast