Package net.tnemc.menu.core.builder
Class IconBuilder
java.lang.Object
net.tnemc.menu.core.builder.IconBuilder
- Since:
- 1.5.0.0
- Author:
- creatorfromhell
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionIconBuilder
(@NotNull net.tnemc.item.AbstractItemStack<?> item) Constructs anIconBuilder
with the specified item. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
withActions
(IconAction... actions) Adds actions to the list of actions for the icon.withClick
(Consumer<MenuClickHandler> click) Sets the click handler for the icon.withConstraint
(Constraint<?> key, String value) Adds a constraint to the icon.withDefaultState
(String defaultState) Sets the default state for the StateIcon.withItemProvider
(@Nullable Function<MenuPlayer, net.tnemc.item.AbstractItemStack<?>> itemProvider) Sets the item provider function for the icon.withPdcApplication
(boolean pdcApplication) Sets whether the PDC application is enabled for this icon builder.withSlot
(int slot) Sets the slot for the icon.Sets the slot for the icon using aSlotPos
object.Adds a state to the StateIcon.withStateHandler
(Function<String, String> stateHandler) Sets the state handler for the StateIcon.withStateID
(String stateID) Sets the state ID for the StateIcon.
-
Field Details
-
constraints
-
-
Constructor Details
-
IconBuilder
public IconBuilder(@NotNull @NotNull net.tnemc.item.AbstractItemStack<?> item) Constructs anIconBuilder
with the specified item.- Parameters:
item
- TheAbstractItemStack
to be used in the icon.
-
-
Method Details
-
withItemProvider
public IconBuilder withItemProvider(@Nullable @Nullable Function<MenuPlayer, net.tnemc.item.AbstractItemStack<?>> itemProvider) Sets the item provider function for the icon.- Parameters:
itemProvider
- The function providing the item for the icon based on theMenuPlayer
.- Returns:
- This
IconBuilder
instance for method chaining.
-
withSlot
Sets the slot for the icon.- Parameters:
slot
- The slot position for the icon.- Returns:
- This
IconBuilder
instance for method chaining.
-
withPdcApplication
Sets whether the PDC application is enabled for this icon builder. This enables better protection against exploits.- Parameters:
pdcApplication
- The boolean value indicating whether the PDC application is enabled.- Returns:
- This
IconBuilder
instance for method chaining.
-
withClick
Sets the click handler for the icon.- Parameters:
click
- The click handler to be executed when the icon is clicked.- Returns:
- This
IconBuilder
instance for method chaining.
-
withStateID
Sets the state ID for the StateIcon.- Parameters:
stateID
- The state ID for the StateIcon.- Returns:
- This
IconBuilder
instance for method chaining.
-
withDefaultState
Sets the default state for the StateIcon.- Parameters:
defaultState
- The default state for the StateIcon.- Returns:
- This
IconBuilder
instance for method chaining.
-
withStateHandler
Sets the state handler for the StateIcon.- Parameters:
stateHandler
- The state handler for the StateIcon.- Returns:
- This
IconBuilder
instance for method chaining.
-
withState
Adds a state to the StateIcon.- Parameters:
stateID
- The state ID.item
- The item associated with the state.- Returns:
- This
IconBuilder
instance for method chaining.
-
build
- Returns:
- The constructed
Icon
orStateIcon
instance.
-