Class FunctionComposable<P>

java.lang.Object
space.maxus.flare.ui.compose.FunctionComposable<P>
All Implemented Interfaces:
ReactivityProvider, Composable, ComposableLike

public abstract class FunctionComposable<P> extends Object implements Composable, ReactivityProvider
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected P
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
     
    void
    click(@NotNull org.bukkit.event.inventory.InventoryClickEvent e)
    Called each time this item is clicked, no matter if it is a right click, left click, middle click, etc.
    abstract @NotNull Composable
     
    @Nullable Composable
     
    void
    handleClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e)
     
    boolean
    handleLeftClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e)
     
    boolean
    handleRightClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e)
     
    boolean
    handleShiftFrom(@NotNull org.bukkit.event.inventory.InventoryClickEvent e)
     
    boolean
    handleShiftInto(@NotNull org.bukkit.inventory.ItemStack stack, @NotNull org.bukkit.event.inventory.InventoryClickEvent e)
     
    void
    Injects frame into this component, the frame can then be retrieved from Composable.root()
    inside(@NotNull ComposableSpace space)
    Fits this composable inside the provided space, essentially returning a pair of this component and the space in the form of a PackedComposable.
    boolean
    leftClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e)
    Called when this component is left clicked inside interface
    void
    Marks this component dirty, meaning its area will be redrawn next tick.
    org.bukkit.inventory.ItemStack
    renderAt(Slot slot)
    Renders this component at the provided slot.
    boolean
    rightClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e)
    Called when this component is right clicked inside interface
    Returns the frame this component belongs to
    final boolean
    shiftFrom(@NotNull org.bukkit.event.inventory.InventoryClickEvent e)
    Called when this component is shift clicked inside interface
    boolean
    shiftInto(@NotNull org.bukkit.inventory.ItemStack stack, @NotNull org.bukkit.event.inventory.InventoryClickEvent e)
    Called when this component is attempted to put items into by shift click.
    useState(V initial)
    Constructs a new ReactiveState
    useUnboundState(V initial)
    Constructs a new ReactiveState that is **explicitly** not bound to this object

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface space.maxus.flare.ui.Composable

    asComposable, bind, context, contextOrNull, destroy, drag, into, restore, viewer

    Methods inherited from interface space.maxus.flare.react.ReactivityProvider

    useBoundState, useMemo
  • Field Details

    • props

      protected P props
  • Constructor Details

    • FunctionComposable

      public FunctionComposable(P props)
  • Method Details

    • activate

      public final void activate()
    • compose

      @NotNull public abstract @NotNull Composable compose()
    • root

      public Frame root()
      Description copied from interface: Composable
      Returns the frame this component belongs to
      Specified by:
      root in interface Composable
      Returns:
      The frame this component belongs to
    • injectRoot

      public void injectRoot(Frame root)
      Description copied from interface: Composable
      Injects frame into this component, the frame can then be retrieved from Composable.root()
      Specified by:
      injectRoot in interface Composable
      Parameters:
      root - Frame to be injected
    • renderAt

      public org.bukkit.inventory.ItemStack renderAt(Slot slot)
      Description copied from interface: Composable
      Renders this component at the provided slot.
      Specified by:
      renderAt in interface Composable
      Parameters:
      slot - Slot to render at
      Returns:
      The rendered item stack
    • markDirty

      public void markDirty()
      Description copied from interface: Composable
      Marks this component dirty, meaning its area will be redrawn next tick.
      Specified by:
      markDirty in interface Composable
    • inside

      @NotNull public @NotNull PackedComposable inside(@NotNull @NotNull ComposableSpace space)
      Description copied from interface: Composable
      Fits this composable inside the provided space, essentially returning a pair of this component and the space in the form of a PackedComposable.
      Specified by:
      inside in interface Composable
      Specified by:
      inside in interface ComposableLike
      Parameters:
      space - Space to fit inside
      Returns:
      A pair of this component and the space in the form of a PackedComposable
    • handleShiftFrom

      public boolean handleShiftFrom(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e)
    • handleShiftInto

      public boolean handleShiftInto(@NotNull @NotNull org.bukkit.inventory.ItemStack stack, @NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e)
    • handleLeftClick

      public boolean handleLeftClick(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e)
    • handleRightClick

      public boolean handleRightClick(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e)
    • handleClick

      public void handleClick(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e)
    • shiftFrom

      public final boolean shiftFrom(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e)
      Description copied from interface: Composable
      Called when this component is shift clicked inside interface
      Specified by:
      shiftFrom in interface Composable
      Parameters:
      e - The click event
      Returns:
      True if the event should be cancelled, false otherwise
    • shiftInto

      public boolean shiftInto(@NotNull @NotNull org.bukkit.inventory.ItemStack stack, @NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e)
      Description copied from interface: Composable
      Called when this component is attempted to put items into by shift click. This means that a player clicked on an item inside their inventory, and Flare attempts to fit item inside this composable.
      Specified by:
      shiftInto in interface Composable
      Parameters:
      stack - Stack that is attempted to be moved.
      e - The click event
      Returns:
      True if the event should be cancelled, false otherwise
    • leftClick

      public boolean leftClick(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e)
      Description copied from interface: Composable
      Called when this component is left clicked inside interface
      Specified by:
      leftClick in interface Composable
      Parameters:
      e - The click event
      Returns:
      True if the event should be cancelled, false otherwise
    • rightClick

      public boolean rightClick(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e)
      Description copied from interface: Composable
      Called when this component is right clicked inside interface
      Specified by:
      rightClick in interface Composable
      Parameters:
      e - The click event
      Returns:
      True if the event should be cancelled, false otherwise
    • click

      public void click(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent e)
      Description copied from interface: Composable
      Called each time this item is clicked, no matter if it is a right click, left click, middle click, etc.
      Specified by:
      click in interface Composable
      Parameters:
      e - The click event
    • useState

      public <V> ReactiveState<V> useState(@Nullable V initial)
      Description copied from interface: ReactivityProvider
      Constructs a new ReactiveState
      Specified by:
      useState in interface ReactivityProvider
      Type Parameters:
      V - Type of the value inside state
      Parameters:
      initial - Initial value of the state
      Returns:
      A new ReactiveState
    • useUnboundState

      public <V> ReactiveState<V> useUnboundState(@Nullable V initial)
      Description copied from interface: ReactivityProvider
      Constructs a new ReactiveState that is **explicitly** not bound to this object
      Specified by:
      useUnboundState in interface ReactivityProvider
      Type Parameters:
      V - Type of the value inside state
      Parameters:
      initial - Initial value of the state
      Returns:
      A new ReactiveState
    • getComposed

      @Nullable public @Nullable Composable getComposed()