public class TextButton extends RenderObjectWidget
TextButton is a button Widget that displays text.

It uses a colored glass pane as the button background, with the text overlaid.

Usage example:


 TextButton.builder()
     .text("Confirm")
     .color(Colors.GREEN)
     .slot(13)
     .onClick(() -> {
         player.sendMessage("Confirmed!");
         player.closeInventory();
     })
     .build();
 
Since:
6.2.0
Version:
1.0.0
Author:
UltiTools Team
  • Field Details

    • text

      @NotNull private final @NotNull String text
    • color

      @NotNull private final @NotNull String color
    • slot

      private final int slot
    • 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 TextButton.Builder builder()
      Creates a Builder.
      Returns:
      the Builder
    • getText

      @NotNull public @NotNull String getText()
    • getColor

      @NotNull public @NotNull String getColor()
    • getSlot

      public int getSlot()
    • 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