Interface Composition

All Superinterfaces:
Composable, ComposableLike, Configurable<Composition>

public interface Composition extends Composable, Configurable<Composition>
A composition is a collection of multiple components, composed by relative coordinates.
See more in Flare docs: Composition
  • Nested Class Summary

    Nested classes/interfaces inherited from interface space.maxus.flare.ui.compose.Configurable

    Configurable.Configurator<S>
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns all composable elements inside this composition
    default 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.
    default boolean
    drag(@NotNull Map<Slot,org.bukkit.inventory.ItemStack> newItems, @NotNull org.bukkit.event.inventory.InventoryDragEvent e)
    Called when items are dragged across this composable inside interface.
     
    default @NotNull PackedComposable
    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.
    default boolean
    leftClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e)
    Called when this component is left clicked inside interface
    static @NotNull Composition
    of(PackedComposable... comps)
    Constructs a composition out of an array of packed composables
    default boolean
    rightClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent e)
    Called when this component is right clicked inside interface
    default boolean
    shiftFrom(@NotNull org.bukkit.event.inventory.InventoryClickEvent e)
    Called when this component is shift clicked inside interface
    default 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.

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

    asComposable, bind, context, contextOrNull, destroy, injectRoot, into, markDirty, renderAt, restore, root, viewer

    Methods inherited from interface space.maxus.flare.ui.compose.Configurable

    configure, configureTyped
  • Method Details

    • of

      @Contract("_ -> new") @NotNull static @NotNull Composition of(PackedComposable... comps)
      Constructs a composition out of an array of packed composables
      Parameters:
      comps - Composable elements to be included
      Returns:
      A new composition
      See Also:
    • fitIn

      @Internal List<PackedComposable> fitIn(ComposableSpace space)
    • children

      List<PackedComposable> children()
      Returns all composable elements inside this composition
      Returns:
      All composable elements inside this composition
    • rightClick

      default 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
    • leftClick

      default 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
    • click

      default 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
    • shiftFrom

      default 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

      default 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
    • drag

      default boolean drag(@NotNull @NotNull Map<Slot,org.bukkit.inventory.ItemStack> newItems, @NotNull @NotNull org.bukkit.event.inventory.InventoryDragEvent e)
      Description copied from interface: Composable
      Called when items are dragged across this composable inside interface. This method is currently experimental and may not work correctly
      Specified by:
      drag in interface Composable
      Parameters:
      newItems - Items that are dragged inside this composable's space
      e - The drag event
      Returns:
      True if the event should be cancelled, false otherwise.
    • inside

      @NotNull default @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