Class PredicateButton

java.lang.Object
io.github.projectunified.craftux.button.PredicateButton
All Implemented Interfaces:
Button, Element

public class PredicateButton extends Object implements Element, Button
The button with predicates
  • Constructor Details

    • PredicateButton

      public PredicateButton()
  • Method Details

    • getViewPredicate

      @Nullable public @Nullable Predicate<UUID> getViewPredicate()
      Get the view predicate
      Returns:
      the view predicate
    • setViewPredicate

      public void setViewPredicate(@NotNull @NotNull Predicate<@NotNull UUID> viewPredicate)
      Set the view predicate
      Parameters:
      viewPredicate - the view predicate
    • getActionPredicate

      @Nullable public @Nullable Predicate<@NotNull Object> getActionPredicate()
      Get the action predicate
      Returns:
      the action predicate
    • setActionPredicate

      public void setActionPredicate(@Nullable @Nullable Predicate<@NotNull Object> actionPredicate)
      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 class
      actionPredicate - 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 class
      actionPredicate - the action predicate
    • getButton

      @Nullable public @Nullable Button getButton()
      Get the button
      Returns:
      the button
    • setButton

      public void setButton(@Nullable @Nullable Button button)
      Set the button
      Parameters:
      button - the button
    • getFallbackButton

      @Nullable public @Nullable Button getFallbackButton()
      Get the fallback button
      Returns:
      the fallback button
    • setFallbackButton

      public void setFallbackButton(@Nullable @Nullable Button fallbackButton)
      Set the fallback button
      Parameters:
      fallbackButton - the fallback button
    • apply

      public boolean apply(@NotNull @NotNull UUID uuid, @NotNull @NotNull ActionItem actionItem)
      Description copied from interface: Button
      Apply actions to the action item
      Specified by:
      apply in interface Button
      Parameters:
      uuid - the uuid of the player
      actionItem - the action item
      Returns:
      true if any action was applied. Can return false in a conditional case (e.g. predicate button)
    • init

      public void init()
      Description copied from interface: Element
      Initialize the element. Should be called before adding to the GUI.
      Specified by:
      init in interface Element
    • stop

      public void stop()
      Description copied from interface: Element
      Stop the element. Should be called after removing from the GUI.
      Specified by:
      stop in interface Element