Class Toast

java.lang.Object
com.github.darksoulq.abyssallib.world.advancement.Toast

public class Toast extends Object
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
    Modifier and Type
    Class
    Description
    static class 
    A fluent builder for creating Toast notifications.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Toast(net.kyori.adventure.text.Component line1, net.kyori.adventure.text.Component line2, org.bukkit.inventory.ItemStack icon, AdvancementFrame frame)
    Constructs a new Toast notification.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new builder instance for constructing Toasts.
    void
    send(org.bukkit.entity.Player player)
    Sends the toast notification to a specific player.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Toast

      public Toast(net.kyori.adventure.text.Component line1, net.kyori.adventure.text.Component line2, org.bukkit.inventory.ItemStack icon, AdvancementFrame frame)
      Constructs a new Toast notification.
      Parameters:
      line1 - The primary header text.
      line2 - The sub-header text.
      icon - The icon to display.
      frame - The visual AdvancementFrame.
  • 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 - The Player who should receive the toast.
    • builder

      public static Toast.Builder builder()
      Creates a new builder instance for constructing Toasts.
      Returns:
      A new Toast.Builder instance.