Class MultiButton
java.lang.Object
me.hsgamer.hscore.minecraft.gui.button.MultiButton
- All Implemented Interfaces:
Function<@NotNull InventoryContext,,@Nullable ActionItem> GUIElement
- Direct Known Subclasses:
AnimatedButton,ListButton
public abstract class MultiButton
extends Object
implements GUIElement, Function<@NotNull InventoryContext,@Nullable ActionItem>
A base button that handles multiple child buttons
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<Function<@NotNull InventoryContext, @Nullable ActionItem>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal <T extends Function<@NotNull InventoryContext,@Nullable ActionItem>>
voidaddButton(@NotNull Collection<@NotNull T> buttons) Add child buttonsfinal voidaddButton(@NotNull Function<@NotNull InventoryContext, @Nullable ActionItem>... button) Add child buttonsfinal List<Function<@NotNull InventoryContext, @Nullable ActionItem>> Get the list of child buttonsvoidinit()Initialize the element.protected booleanWhether to require child buttonsvoidstop()Stop the element.
-
Field Details
-
buttons
-
-
Constructor Details
-
MultiButton
public MultiButton()
-
-
Method Details
-
requireChildButtons
protected boolean requireChildButtons()Whether to require child buttons- Returns:
- true if child buttons are required
-
addButton
public final <T extends Function<@NotNull InventoryContext,@Nullable ActionItem>> void addButton(@NotNull @NotNull Collection<@NotNull T> buttons) Add child buttons- Type Parameters:
T- the type of the button- Parameters:
buttons- the child buttons
-
addButton
@SafeVarargs public final void addButton(@NotNull @NotNull Function<@NotNull InventoryContext, @Nullable ActionItem>... button) Add child buttons- Parameters:
button- the button
-
getButtons
Get the list of child buttons- Returns:
- the list of child buttons
-
init
public void init()Description copied from interface:GUIElementInitialize the element. Should be called before adding to the GUI.- Specified by:
initin interfaceGUIElement
-
stop
public void stop()Description copied from interface:GUIElementStop the element. Should be called after removing from the GUI.- Specified by:
stopin interfaceGUIElement
-