Class GuiItem.Builder

java.lang.Object
io.github.somesourcecode.someguiapi.scene.GuiItem.Builder
Enclosing class:
GuiItem

public static class GuiItem.Builder extends Object
The builder for the GuiItem class. Allows for easy construction of GuiItem objects, by making use of a fluent API.
Since:
1.0.0
  • Method Details

    • at

      public GuiItem.Builder at(int x, int y)
      Relocates the item to the given coordinates.
      Parameters:
      x - the x coordinate
      y - the y coordinate
      Returns:
      the builder for method chaining
      Since:
      1.0.0
    • atX

      public GuiItem.Builder atX(int x)
      Relocates the item to the given x coordinate.
      Parameters:
      x - the x coordinate
      Returns:
      the builder for method chaining
      Since:
      1.0.0
    • atY

      public GuiItem.Builder atY(int y)
      Relocates the item to the given y coordinate.
      Parameters:
      y - the y coordinate
      Returns:
      the builder for method chaining
      Since:
      1.0.0
    • withId

      public GuiItem.Builder withId(String id)
      Sets the id of the item.
      Parameters:
      id - the id
      Returns:
      the builder for method chaining
      Since:
      2.0.0
    • withMaterial

      public GuiItem.Builder withMaterial(org.bukkit.Material material)
      Sets the material of the item.
      Parameters:
      material - the material
      Returns:
      the builder for method chaining
      Since:
      1.0.0
    • withTitle

      public GuiItem.Builder withTitle(net.kyori.adventure.text.Component title)
      Sets the title of the item.
      Parameters:
      title - the title
      Returns:
      the builder for method chaining
      Since:
      1.0.0
    • withLore

      public GuiItem.Builder withLore(Lore lore)
      Sets the lore of the item.
      Parameters:
      lore - the lore
      Returns:
      the builder for method chaining
      Since:
      2.0.0
    • withIndex

      public GuiItem.Builder withIndex(int index)
      Sets the index of the item.
      Parameters:
      index - the index
      Returns:
      the builder for method chaining
      Since:
      1.0.0
    • withGlow

      public GuiItem.Builder withGlow(boolean glow)
      Sets whether the item should glow.
      Parameters:
      glow - whether the item should glow
      Returns:
      the builder for method chaining
      Since:
      1.0.0
    • withGlow

      public GuiItem.Builder withGlow()
      Sets the glow of the item to true.
      Returns:
      the builder for method chaining
      Since:
      2.0.0
    • withoutGlow

      public GuiItem.Builder withoutGlow()
      Sets the glow of the item to false.
      Returns:
      the builder for method chaining
      Since:
      2.0.0
    • onClick

      public GuiItem.Builder onClick(java.util.function.Consumer<NodeClickContext> onClick)
      Sets the consumer that is called when the node is clicked.

      This consumer will be called when the node is clicked, regardless of the type of click.

      Parameters:
      onClick - the consumer that is called when the node is clicked
      Returns:
      the builder for method chaining
      Since:
      1.0.0
    • onLeftClick

      public GuiItem.Builder onLeftClick(java.util.function.Consumer<NodeClickContext> onLeftClick)
      Sets the consumer that is called when the node is left-clicked.
      Parameters:
      onLeftClick - the consumer that is called when the node is left-clicked
      Returns:
      the builder for method chaining
      Since:
      1.0.0
    • onRightClick

      public GuiItem.Builder onRightClick(java.util.function.Consumer<NodeClickContext> onRightClick)
      Sets the consumer that is called when the node is right-clicked.
      Parameters:
      onRightClick - the consumer that is called when the node is right-clicked
      Returns:
      the builder for method chaining
      Since:
      1.0.0
    • onShiftClick

      public GuiItem.Builder onShiftClick(java.util.function.Consumer<NodeClickContext> onShiftClick)
      Sets the consumer that is called when the node is shift-clicked.
      Parameters:
      onShiftClick - the consumer that is called when the node is shift-clicked
      Returns:
      the builder for method chaining
      Since:
      1.0.0
    • onHotBarClick

      public GuiItem.Builder onHotBarClick(java.util.function.Consumer<NodeClickContext> onHotBarClick)
      Sets the consumer that is called when the node receives a hot bar click.
      Parameters:
      onHotBarClick - the consumer that is called when the node receives a hot bar click
      Returns:
      the builder for method chaining
      Since:
      1.0.0
    • build

      public GuiItem build()
      Builds the GuiItem object.
      Returns:
      the GuiItem object
      Since:
      1.0.0