Class RenderContext

java.lang.Object
me.devnatan.inventoryframework.state.DefaultStateValueHost
me.devnatan.inventoryframework.context.PlatformContext
me.devnatan.inventoryframework.context.PlatformRenderContext<BukkitItemComponentBuilder,Context>
me.devnatan.inventoryframework.context.RenderContext
All Implemented Interfaces:
Iterable<me.devnatan.inventoryframework.component.Component>, me.devnatan.inventoryframework.component.ComponentContainer, Context, me.devnatan.inventoryframework.context.IFConfinedContext, me.devnatan.inventoryframework.context.IFContext, me.devnatan.inventoryframework.context.IFRenderContext, me.devnatan.inventoryframework.state.StateValueHost, me.devnatan.inventoryframework.VirtualView

public final class RenderContext extends me.devnatan.inventoryframework.context.PlatformRenderContext<BukkitItemComponentBuilder,Context> implements Context
  • Field Summary

    Fields inherited from class me.devnatan.inventoryframework.context.PlatformRenderContext

    root
  • Constructor Summary

    Constructors
    Constructor
    Description
    RenderContext(@NotNull UUID id, @NotNull View root, @NotNull me.devnatan.inventoryframework.ViewConfig config, @NotNull me.devnatan.inventoryframework.ViewContainer container, @NotNull Map<String,me.devnatan.inventoryframework.Viewer> viewers, me.devnatan.inventoryframework.Viewer subject, Object initialData)
    This is an internal inventory-framework API that should not be used from outside of this library.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addComponent(me.devnatan.inventoryframework.component.Component arg0)
     
    final void
    addViewer(me.devnatan.inventoryframework.Viewer arg0)
     
    availableSlot(@Nullable org.bukkit.inventory.ItemStack item)
    Adds an item in the next available slot of this context's container.
    void
     
    void
    back(Object arg0)
     
    boolean
     
     
    boolean
     
    firstSlot(@Nullable org.bukkit.inventory.ItemStack item)
    Sets an item in the first slot of this context's container.
    List<org.bukkit.entity.Player>
    This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.
    List<me.devnatan.inventoryframework.component.Component>
     
    List<me.devnatan.inventoryframework.component.Component>
    getComponentsAt(int arg0)
     
    final String
     
    List<me.devnatan.inventoryframework.component.Component>
     
    @NotNull org.bukkit.entity.Player
    The player for the current interaction context.
    @NotNull View
     
    final List<me.devnatan.inventoryframework.Viewer>
     
    int
     
    final boolean
     
    final Iterator<me.devnatan.inventoryframework.component.Component>
     
    lastSlot(@Nullable org.bukkit.inventory.ItemStack item)
    Sets an item in the last slot of this context's container.
    layoutSlot(char character, @Nullable org.bukkit.inventory.ItemStack item)
    Defines the item that will represent a character provided in the context layout.
    void
    performClickInComponent(me.devnatan.inventoryframework.component.Component arg0, me.devnatan.inventoryframework.Viewer arg1, me.devnatan.inventoryframework.ViewContainer arg2, Object arg3, int arg4, boolean arg5)
     
    void
    removeComponent(me.devnatan.inventoryframework.component.Component arg0)
     
    final void
    removeViewer(me.devnatan.inventoryframework.Viewer arg0)
     
    void
    renderComponent(me.devnatan.inventoryframework.component.Component arg0)
     
    void
    resetTitleForPlayer(@NotNull org.bukkit.entity.Player player)
    Resets the container title only for the player current scope of execution to the initially defined title.
    resultSlot(@Nullable org.bukkit.inventory.ItemStack item)
    This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.
    slot(int row, int column, @Nullable org.bukkit.inventory.ItemStack item)
    Adds an item at the specific column and ROW (X, Y) in that context's container.
    slot(int slot, @Nullable org.bukkit.inventory.ItemStack item)
    Adds an item to a specific slot in the context container.
     
    (package private) final void
     
    (package private) final void
     
    void
     
    void
    updateComponent(me.devnatan.inventoryframework.component.Component arg0, boolean arg1)
     
    void
    updateTitleForPlayer(@NotNull String title, @NotNull org.bukkit.entity.Player player)
    Updates the container title for a specific player.

    Methods inherited from class me.devnatan.inventoryframework.context.PlatformRenderContext

    addLayoutSlot, availableSlot, availableSlot, closeForPlayer, createRegisteredBuilder, firstSlot, getAvailableSlotFactories, getComponentFactories, getConfig, getContainer, getId, getIndexedViewers, getInitialData, getLayoutSlots, getViewer, isRendered, lastSlot, layoutSlot, layoutSlot, openForPlayer, openForPlayer, resetTitleForPlayer, resultSlot, setInitialData, setRendered, slot, slot, unsetSlot, updateTitleForPlayer

    Methods inherited from class me.devnatan.inventoryframework.context.PlatformContext

    closeForEveryone, getContainerOrThrow, getTitle, getUpdatedTitle, isActive, isEndless, openForEveryone, openForEveryone, resetTitleForEveryone, setActive, setEndless, updateTitleForEveryone

    Methods inherited from class me.devnatan.inventoryframework.state.DefaultStateValueHost

    getInternalStateValue, getRawStateValue, getStateValues, getUninitializedStateValue, initializeState, updateState, watchState

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface me.devnatan.inventoryframework.component.ComponentContainer

    getComponents, getInternalComponents

    Methods inherited from interface me.devnatan.inventoryframework.context.IFConfinedContext

    back, back, canBack, closeForPlayer, getViewer, openForPlayer, openForPlayer, resetTitleForPlayer, updateTitleForPlayer

    Methods inherited from interface me.devnatan.inventoryframework.context.IFContext

    addComponent, addViewer, closeForEveryone, getComponentsAt, getConfig, getId, getIndexedViewers, getInitialData, getInitialTitle, getViewers, isActive, isEndless, isShared, openForEveryone, openForEveryone, performClickInComponent, removeComponent, removeViewer, renderComponent, resetTitleForEveryone, setActive, setEndless, setInitialData, update, updateComponent, updateTitleForEveryone

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator

    Methods inherited from interface me.devnatan.inventoryframework.state.StateValueHost

    getInternalStateValue, getRawStateValue, getStateValues, getUninitializedStateValue, initializeState, updateState, watchState
  • Constructor Details

    • RenderContext

      @Internal public RenderContext(@NotNull @NotNull UUID id, @NotNull @NotNull View root, @NotNull @NotNull me.devnatan.inventoryframework.ViewConfig config, @NotNull @NotNull me.devnatan.inventoryframework.ViewContainer container, @NotNull @NotNull Map<String,me.devnatan.inventoryframework.Viewer> viewers, me.devnatan.inventoryframework.Viewer subject, Object initialData)
      This is an internal inventory-framework API that should not be used from outside of this library. No compatibility guarantees are provided.
  • Method Details

    • getRoot

      @NotNull public @NotNull View getRoot()
      Specified by:
      getRoot in interface me.devnatan.inventoryframework.context.IFContext
      Specified by:
      getRoot in class me.devnatan.inventoryframework.context.PlatformContext
    • getPlayer

      @NotNull public @NotNull org.bukkit.entity.Player getPlayer()
      Description copied from interface: Context
      The player for the current interaction context.

      Contexts can be shared and contain multiple viewers, this method will always return the player for the current event.

      Specified by:
      getPlayer in interface Context
      Returns:
      A player in this interaction context.
    • getAllPlayers

      public List<org.bukkit.entity.Player> getAllPlayers()
      Description copied from interface: Context

      This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.

      Specified by:
      getAllPlayers in interface Context
    • updateTitleForPlayer

      public void updateTitleForPlayer(@NotNull @NotNull String title, @NotNull @NotNull org.bukkit.entity.Player player)
      Description copied from interface: Context
      Updates the container title for a specific player.

      This should not be used before the container is opened, if you need to set the __initial title__ use IFOpenContext.modifyConfig() on open handler instead.

      This method is version dependant, so it may be that your server version is not yet supported, if you try to use this method and fail (can fail silently), report it to the library developers to add support to your version.

      This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.

      Specified by:
      updateTitleForPlayer in interface Context
      Parameters:
      title - The new container title.
      player - The player to update the title.
    • resetTitleForPlayer

      public void resetTitleForPlayer(@NotNull @NotNull org.bukkit.entity.Player player)
      Description copied from interface: Context
      Resets the container title only for the player current scope of execution to the initially defined title. Must be used after Context.updateTitleForPlayer(String, Player) to take effect.

      This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.

      Specified by:
      resetTitleForPlayer in interface Context
      Parameters:
      player - The player to reset the title.
    • slot

      @NotNull public @NotNull BukkitItemComponentBuilder slot(int slot, @Nullable @Nullable org.bukkit.inventory.ItemStack item)
      Adds an item to a specific slot in the context container.
      Parameters:
      slot - The slot in which the item will be positioned.
      Returns:
      An item builder to configure the item.
    • slot

      @NotNull public @NotNull BukkitItemComponentBuilder slot(int row, int column, @Nullable @Nullable org.bukkit.inventory.ItemStack item)
      Adds an item at the specific column and ROW (X, Y) in that context's container.
      Parameters:
      row - The row (Y) in which the item will be positioned.
      column - The column (X) in which the item will be positioned.
      Returns:
      An item builder to configure the item.
    • firstSlot

      @NotNull public @NotNull BukkitItemComponentBuilder firstSlot(@Nullable @Nullable org.bukkit.inventory.ItemStack item)
      Sets an item in the first slot of this context's container.
      Parameters:
      item - The item that'll be set.
      Returns:
      An item builder to configure the item.
    • lastSlot

      @NotNull public @NotNull BukkitItemComponentBuilder lastSlot(@Nullable @Nullable org.bukkit.inventory.ItemStack item)
      Sets an item in the last slot of this context's container.
      Parameters:
      item - The item that'll be set.
      Returns:
      An item builder to configure the item.
    • availableSlot

      @NotNull public @NotNull BukkitItemComponentBuilder availableSlot(@Nullable @Nullable org.bukkit.inventory.ItemStack item)
      Adds an item in the next available slot of this context's container.
      Parameters:
      item - The item that'll be added.
      Returns:
      An item builder to configure the item.
    • layoutSlot

      @NotNull public @NotNull BukkitItemComponentBuilder layoutSlot(char character, @Nullable @Nullable org.bukkit.inventory.ItemStack item)
      Defines the item that will represent a character provided in the context layout.
      Parameters:
      character - The layout character target.
      item - The item that'll represent the layout character.
      Returns:
      An item builder to configure the item.
    • resultSlot

      @Experimental @NotNull public @NotNull BukkitItemComponentBuilder resultSlot(@Nullable @Nullable org.bukkit.inventory.ItemStack item)

      This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.

    • createBuilder

      protected BukkitItemComponentBuilder createBuilder()
      Specified by:
      createBuilder in class me.devnatan.inventoryframework.context.PlatformRenderContext<BukkitItemComponentBuilder,Context>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class me.devnatan.inventoryframework.context.PlatformContext
    • back

      public void back()
      Specified by:
      back in interface me.devnatan.inventoryframework.context.IFConfinedContext
    • back

      public void back(Object arg0)
      Specified by:
      back in interface me.devnatan.inventoryframework.context.IFConfinedContext
    • canBack

      public boolean canBack()
      Specified by:
      canBack in interface me.devnatan.inventoryframework.context.IFConfinedContext
    • getViewers

      @NotNull public final List<me.devnatan.inventoryframework.Viewer> getViewers()
      Specified by:
      getViewers in interface me.devnatan.inventoryframework.context.IFContext
    • addViewer

      public final void addViewer(@NotNull me.devnatan.inventoryframework.Viewer arg0)
      Specified by:
      addViewer in interface me.devnatan.inventoryframework.context.IFContext
    • removeViewer

      public final void removeViewer(@NotNull me.devnatan.inventoryframework.Viewer arg0)
      Specified by:
      removeViewer in interface me.devnatan.inventoryframework.context.IFContext
    • getInitialTitle

      @NotNull public final String getInitialTitle()
      Specified by:
      getInitialTitle in interface me.devnatan.inventoryframework.context.IFContext
    • getComponents

      @NotNull public List<me.devnatan.inventoryframework.component.Component> getComponents()
      Specified by:
      getComponents in interface me.devnatan.inventoryframework.component.ComponentContainer
    • getInternalComponents

      public List<me.devnatan.inventoryframework.component.Component> getInternalComponents()
      Specified by:
      getInternalComponents in interface me.devnatan.inventoryframework.component.ComponentContainer
    • getComponentsAt

      public List<me.devnatan.inventoryframework.component.Component> getComponentsAt(int arg0)
      Specified by:
      getComponentsAt in interface me.devnatan.inventoryframework.context.IFContext
    • addComponent

      public void addComponent(@NotNull me.devnatan.inventoryframework.component.Component arg0)
      Specified by:
      addComponent in interface me.devnatan.inventoryframework.context.IFContext
    • removeComponent

      public void removeComponent(@NotNull me.devnatan.inventoryframework.component.Component arg0)
      Specified by:
      removeComponent in interface me.devnatan.inventoryframework.context.IFContext
    • renderComponent

      public void renderComponent(@NotNull me.devnatan.inventoryframework.component.Component arg0)
      Specified by:
      renderComponent in interface me.devnatan.inventoryframework.context.IFContext
    • updateComponent

      public void updateComponent(@NotNull me.devnatan.inventoryframework.component.Component arg0, boolean arg1)
      Specified by:
      updateComponent in interface me.devnatan.inventoryframework.context.IFContext
    • performClickInComponent

      public void performClickInComponent(@NotNull me.devnatan.inventoryframework.component.Component arg0, @NotNull me.devnatan.inventoryframework.Viewer arg1, @NotNull me.devnatan.inventoryframework.ViewContainer arg2, Object arg3, int arg4, boolean arg5)
      Specified by:
      performClickInComponent in interface me.devnatan.inventoryframework.context.IFContext
    • update

      public void update()
      Specified by:
      update in interface me.devnatan.inventoryframework.context.IFContext
    • isShared

      public final boolean isShared()
      Specified by:
      isShared in interface me.devnatan.inventoryframework.context.IFContext
    • iterator

      @NotNull public final Iterator<me.devnatan.inventoryframework.component.Component> iterator()
      Specified by:
      iterator in interface Iterable<me.devnatan.inventoryframework.component.Component>
    • tryThrowDoNotWorkWithSharedContext

      final void tryThrowDoNotWorkWithSharedContext()
    • tryThrowDoNotWorkWithSharedContext

      final void tryThrowDoNotWorkWithSharedContext(String arg0)