public class ItemDisplay extends RenderObjectWidget
ItemDisplay is a Widget that displays an item.

It is the most basic render Widget, showing a single ItemStack at a given slot.

Usage example:


 ItemDisplay.builder(itemStack)
     .slot(10)
     .key("my-item")
     .onClick(event -> player.sendMessage("Clicked!"))
     .build();
 
Since:
6.2.0
Version:
1.0.0
Author:
UltiTools Team
  • Field Details

    • itemStack

      @NotNull private final @NotNull org.bukkit.inventory.ItemStack itemStack
    • slot

      private final int slot
    • displayName

      @Nullable private final @Nullable String displayName
    • lore

      @Nullable private final @Nullable String[] lore
    • clickHandler

      @Nullable private final @Nullable Consumer<org.bukkit.event.inventory.InventoryClickEvent> clickHandler
  • Constructor Details

  • Method Details

    • builder

      @NotNull public static @NotNull ItemDisplay.Builder builder(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      Creates a Builder.
      Parameters:
      itemStack - the item
      Returns:
      the Builder
    • getItemStack

      @NotNull public @NotNull org.bukkit.inventory.ItemStack getItemStack()
    • getSlot

      public int getSlot()
    • getDisplayName

      @Nullable public @Nullable String getDisplayName()
    • getLore

      @Nullable public @Nullable String[] getLore()
    • getClickHandler

      @Nullable public @Nullable Consumer<org.bukkit.event.inventory.InventoryClickEvent> getClickHandler()
    • createElement

      @NotNull public @NotNull RenderObjectElement createElement()
      Description copied from class: Widget
      Creates the Element corresponding to this Widget.

      This is a framework-internal method; subclasses should return the Element implementation appropriate to the Widget type.

      Specified by:
      createElement in class RenderObjectWidget
      Returns:
      the corresponding Element instance