Class PredicateButton
java.lang.Object
io.github.projectunified.craftux.button.PredicateButton
The button with predicates
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
apply
(@NotNull UUID uuid, @NotNull ActionItem actionItem) Apply actions to the action item<E> void
expandActionPredicate
(@NotNull Class<E> eventClass, @NotNull BiPredicate<@NotNull E, @Nullable Predicate<Object>> actionPredicate) Expand the action predicate for a specific event classvoid
expandActionPredicate
(@NotNull BiPredicate<@NotNull Object, @Nullable Predicate<Object>> actionPredicate) Expand the action predicateGet the action predicate@Nullable Button
Get the button@Nullable Button
Get the fallback buttonGet the view predicatevoid
init()
Initialize the element.<E> void
setActionPredicate
(@NotNull Class<E> eventClass, @NotNull Predicate<@NotNull E> actionPredicate) Set the action predicate for a specific event classvoid
setActionPredicate
(@Nullable Predicate<@NotNull Object> actionPredicate) Set the action predicatevoid
Set the buttonvoid
setFallbackButton
(@Nullable Button fallbackButton) Set the fallback buttonvoid
setViewPredicate
(@NotNull Predicate<@NotNull UUID> viewPredicate) Set the view predicatevoid
stop()
Stop the element.
-
Constructor Details
-
PredicateButton
public PredicateButton()
-
-
Method Details
-
getViewPredicate
Get the view predicate- Returns:
- the view predicate
-
setViewPredicate
Set the view predicate- Parameters:
viewPredicate
- the view predicate
-
getActionPredicate
Get the action predicate- Returns:
- the action predicate
-
setActionPredicate
Set the action predicate- Parameters:
actionPredicate
- the action predicate
-
setActionPredicate
public <E> void setActionPredicate(@NotNull @NotNull Class<E> eventClass, @NotNull @NotNull Predicate<@NotNull E> actionPredicate) Set the action predicate for a specific event class- Type Parameters:
E
- the event type- Parameters:
eventClass
- the event classactionPredicate
- the action predicate
-
expandActionPredicate
public void expandActionPredicate(@NotNull @NotNull BiPredicate<@NotNull Object, @Nullable Predicate<Object>> actionPredicate) Expand the action predicate- Parameters:
actionPredicate
- the action predicate
-
expandActionPredicate
public <E> void expandActionPredicate(@NotNull @NotNull Class<E> eventClass, @NotNull @NotNull BiPredicate<@NotNull E, @Nullable Predicate<Object>> actionPredicate) Expand the action predicate for a specific event class- Type Parameters:
E
- the event type- Parameters:
eventClass
- the event classactionPredicate
- the action predicate
-
getButton
Get the button- Returns:
- the button
-
setButton
Set the button- Parameters:
button
- the button
-
getFallbackButton
Get the fallback button- Returns:
- the fallback button
-
setFallbackButton
Set the fallback button- Parameters:
fallbackButton
- the fallback button
-
apply
Description copied from interface:Button
Apply actions to the action item -
init
public void init()Description copied from interface:Element
Initialize the element. Should be called before adding to the GUI. -
stop
public void stop()Description copied from interface:Element
Stop the element. Should be called after removing from the GUI.
-