All Implemented Interfaces:
Flippable, Orientable, Rotatable

public class Label extends OutlinePane
A label for displaying text.
Since:
0.5.0
  • Constructor Details

    • Label

      public Label(@NotNull @NotNull Slot slot, int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Font font, @NotNull @NotNull Plugin plugin)
      Creates a new label
      Parameters:
      slot - the slot
      length - the length
      height - the height
      priority - the priority
      font - the character set
      plugin - the plugin that will be the owner for this label's items
      Since:
      0.10.8
      See Also:
    • Label

      public Label(int x, int y, int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Font font, @NotNull @NotNull Plugin plugin)
      Creates a new label
      Parameters:
      x - the x coordinate
      y - the y coordinate
      length - the length
      height - the height
      priority - the priority
      font - the character set
      plugin - the plugin that will be the owner for this label's items
      Since:
      0.10.8
      See Also:
    • Label

      public Label(@NotNull @NotNull Slot slot, int length, int height, @NotNull @NotNull Font font, @NotNull @NotNull Plugin plugin)
      Creates a new label
      Parameters:
      slot - the slot
      length - the length
      height - the height
      font - the character set
      plugin - the plugin that will be the owner for this label's items
      Since:
      0.10.8
      See Also:
    • Label

      public Label(int x, int y, int length, int height, @NotNull @NotNull Font font, @NotNull @NotNull Plugin plugin)
      Creates a new label
      Parameters:
      x - the x coordinate
      y - the y coordinate
      length - the length
      height - the height
      font - the character set
      plugin - the plugin that will be the owner for this label's items
      Since:
      0.10.8
      See Also:
    • Label

      public Label(int length, int height, @NotNull @NotNull Font font, @NotNull @NotNull Plugin plugin)
      Creates a new label
      Parameters:
      length - the length
      height - the height
      font - the character set
      plugin - the plugin that will be the owner for this label's items
      Since:
      0.10.8
      See Also:
    • Label

      public Label(@NotNull @NotNull Slot slot, int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Font font)
      Creates a new label
      Parameters:
      slot - the slot
      length - the length
      height - the height
      priority - the priority
      font - the character set
      Since:
      0.10.8
    • Label

      public Label(int x, int y, int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Font font)
      Creates a new label
      Parameters:
      x - the x coordinate
      y - the y coordinate
      length - the length
      height - the height
      priority - the priority
      font - the character set
      Since:
      0.5.0
    • Label

      public Label(@NotNull @NotNull Slot slot, int length, int height, @NotNull @NotNull Font font)
      Creates a new label
      Parameters:
      slot - the slot
      length - the length
      height - the height
      font - the character set
      Since:
      0.10.8
    • Label

      public Label(int x, int y, int length, int height, @NotNull @NotNull Font font)
      Creates a new label
      Parameters:
      x - the x coordinate
      y - the y coordinate
      length - the length
      height - the height
      font - the character set
      Since:
      0.5.0
    • Label

      public Label(int length, int height, @NotNull @NotNull Font font)
      Creates a new label
      Parameters:
      length - the length
      height - the height
      font - the character set
      Since:
      0.5.0
  • Method Details

    • setText

      public void setText(@NotNull @NotNull String text, @NotNull @NotNull BiFunction<? super @NotNull Character,? super @NotNull ItemStack,? extends @NotNull GuiItem> processor)
      Sets the text to be displayed in this label. If this label already had text, this text will be overwritten. The specified processor will be called for each character that is part of the specified text. The provided character will be the original character that was attempted to be shown - it is not subject to any transformations that may be applied for finding a valid item corresponding to this character, such as capitalization changes.
      Parameters:
      text - the new text
      processor - processes each character before using them
      Since:
      0.10.4
    • setText

      public void setText(@NotNull @NotNull String text)
      Sets the text to be displayed in this label. If this label already had text, this text will be overwritten.
      Parameters:
      text - the new text
      Since:
      0.5.0
      See Also:
    • copy

      @NotNull @Contract(pure=true) public @NotNull Label copy()
      Description copied from class: Pane
      Makes a copy of this pane and returns it. This makes a deep copy of the pane. This entails that the underlying panes and/or items will be copied as well. The returned pane will never be reference equal to the current pane.
      Overrides:
      copy in class OutlinePane
      Returns:
      a copy of this pane
    • click

      public boolean click(@NotNull @NotNull Gui gui, @NotNull @NotNull InventoryComponent inventoryComponent, @NotNull @NotNull InventoryClickEvent event, int slot, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight)
      Description copied from class: Pane
      Called whenever there is being clicked on this pane
      Overrides:
      click in class OutlinePane
      Parameters:
      gui - the gui in which was clicked
      inventoryComponent - the inventory component in which this pane resides
      event - the event that occurred while clicking on this item
      slot - the slot that was clicked in
      paneOffsetX - the pane's offset on the x axis
      paneOffsetY - the pane's offset on the y axis
      maxLength - the maximum length of the pane
      maxHeight - the maximum height of the pane
      Returns:
      whether the item was found or not
    • getText

      @Contract(pure=true) @NotNull public @NotNull String getText()
      Gets the text currently displayed in this label
      Returns:
      the text in this label
      Since:
      0.5.0
    • getFont

      @Contract(pure=true) @NotNull public @NotNull Font getFont()
      Gets the character set currently used for the text in this label
      Returns:
      the character set
      Since:
      0.5.0
    • load

      @NotNull @Contract(pure=true) public static @NotNull Label load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element, @NotNull @NotNull Plugin plugin)
      Loads a label from a given element
      Parameters:
      instance - the instance class
      element - the element
      plugin - the plugin that will be the owner of the underlying items
      Returns:
      the percentage bar
      Since:
      0.10.8
    • load

      @NotNull @Contract(pure=true) @Deprecated public static @NotNull Label load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element)
      Deprecated.
      this method is no longer used internally and has been superseded by load(Object, Element, Plugin)
      Loads a label from a given element
      Parameters:
      instance - the instance class
      element - the element
      Returns:
      the percentage bar