Class SimpleButton
java.lang.Object
io.github.projectunified.craftux.simple.SimpleButton
- All Implemented Interfaces:
Button
A simple implementation of Button that sets an item and action for an ActionItem.
The item can be a static value or computed per player, and the action handles click events.
Example usage:
// Static item and action
SimpleButton button = new SimpleButton(new ItemStack(Material.DIAMOND), event -> System.out.println("Clicked"));
// Dynamic item based on player
SimpleButton dynamicButton = new SimpleButton(
uuid -> new ItemStack(Material.EMERALD, getPlayerLevel(uuid)),
event -> System.out.println("Dynamic button clicked")
);
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleButton(@Nullable Object item) Create a new buttonSimpleButton(@Nullable Object item, @NotNull Consumer<@NotNull Object> consumer) Create a new buttonSimpleButton(@NotNull Consumer<@NotNull Object> consumer) Create a new button with a null itemSimpleButton(@NotNull Function<@NotNull UUID, @Nullable Object> itemFunction) Create a new buttonSimpleButton(@NotNull Function<@NotNull UUID, @Nullable Object> itemFunction, @NotNull Consumer<@NotNull Object> consumer) Create a new simple button -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(@NotNull UUID uuid, @NotNull ActionItem actionItem) Apply actions to the action item
-
Constructor Details
-
SimpleButton
public SimpleButton(@NotNull @NotNull Function<@NotNull UUID, @Nullable Object> itemFunction, @NotNull @NotNull Consumer<@NotNull Object> consumer) Create a new simple button- Parameters:
itemFunction- the item functionconsumer- the consumer
-
SimpleButton
public SimpleButton(@Nullable @Nullable Object item, @NotNull @NotNull Consumer<@NotNull Object> consumer) Create a new button- Parameters:
item- the itemconsumer- the consumer
-
SimpleButton
Create a new button with a null item- Parameters:
consumer- the consumer
-
SimpleButton
Create a new button- Parameters:
itemFunction- the item function
-
SimpleButton
Create a new button- Parameters:
item- the item
-
-
Method Details