Class GuiItem.Builder
java.lang.Object
io.github.somesourcecode.someguiapi.scene.GuiItem.Builder
- Enclosing class:
- GuiItem
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 Summary
Modifier and TypeMethodDescriptionat(int x, int y) Relocates the item to the given coordinates.atX(int x) Relocates the item to the given x coordinate.atY(int y) Relocates the item to the given y coordinate.build()Builds the GuiItem object.onClick(java.util.function.Consumer<NodeClickContext> onClick) Sets the consumer that is called when the node is clicked.onHotBarClick(java.util.function.Consumer<NodeClickContext> onHotBarClick) Sets the consumer that is called when the node receives a hot bar click.onLeftClick(java.util.function.Consumer<NodeClickContext> onLeftClick) Sets the consumer that is called when the node is left-clicked.onRightClick(java.util.function.Consumer<NodeClickContext> onRightClick) Sets the consumer that is called when the node is right-clicked.onShiftClick(java.util.function.Consumer<NodeClickContext> onShiftClick) Sets the consumer that is called when the node is shift-clicked.withGlow()Sets the glow of the item to true.withGlow(boolean glow) Sets whether the item should glow.Sets the id of the item.withIndex(int index) Sets the index of the item.Sets the lore of the item.withMaterial(org.bukkit.Material material) Sets the material of the item.Sets the glow of the item to false.withTitle(net.kyori.adventure.text.Component title) Sets the title of the item.
-
Method Details
-
at
Relocates the item to the given coordinates.- Parameters:
x- the x coordinatey- the y coordinate- Returns:
- the builder for method chaining
- Since:
- 1.0.0
-
atX
Relocates the item to the given x coordinate.- Parameters:
x- the x coordinate- Returns:
- the builder for method chaining
- Since:
- 1.0.0
-
atY
Relocates the item to the given y coordinate.- Parameters:
y- the y coordinate- Returns:
- the builder for method chaining
- Since:
- 1.0.0
-
withId
Sets the id of the item.- Parameters:
id- the id- Returns:
- the builder for method chaining
- Since:
- 2.0.0
-
withMaterial
Sets the material of the item.- Parameters:
material- the material- Returns:
- the builder for method chaining
- Since:
- 1.0.0
-
withTitle
Sets the title of the item.- Parameters:
title- the title- Returns:
- the builder for method chaining
- Since:
- 1.0.0
-
withLore
Sets the lore of the item.- Parameters:
lore- the lore- Returns:
- the builder for method chaining
- Since:
- 2.0.0
-
withIndex
Sets the index of the item.- Parameters:
index- the index- Returns:
- the builder for method chaining
- Since:
- 1.0.0
-
withGlow
Sets whether the item should glow.- Parameters:
glow- whether the item should glow- Returns:
- the builder for method chaining
- Since:
- 1.0.0
-
withGlow
Sets the glow of the item to true.- Returns:
- the builder for method chaining
- Since:
- 2.0.0
-
withoutGlow
Sets the glow of the item to false.- Returns:
- the builder for method chaining
- Since:
- 2.0.0
-
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
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
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
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
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
Builds the GuiItem object.- Returns:
- the GuiItem object
- Since:
- 1.0.0
-