Class ChestBackend

java.lang.Object
com.ultikits.ultitools.ui.chest.ChestBackend
All Implemented Interfaces:
BoundSlotRenderer, UiBackend

@Internal public final class ChestBackend extends Object implements UiBackend, BoundSlotRenderer
The framework's grid-only backend. All screen items are copies, never the source of real item moves.
  • Field Details

  • Constructor Details

  • Method Details

    • id

      public net.kyori.adventure.key.Key id()
      Description copied from interface: UiBackend
      Unique backend identity.
      Specified by:
      id in interface UiBackend
    • priority

      public int priority()
      Description copied from interface: UiBackend
      Higher wins; unique among registered backends. Framework values: Dialog 100, chest 0.
      Specified by:
      priority in interface UiBackend
    • supports

      public boolean supports(UiIntent<?> intent, org.bukkit.entity.Player viewer)
      Description copied from interface: UiBackend
      Whether this backend can show intent to viewer now. May depend on the intent's content (for example the inputs of a form) and on the viewer (for example client capabilities).
      Specified by:
      supports in interface UiBackend
    • open

      public <R> void open(UiSession<R> session, UiBackend.BackendCallbacks<R> callbacks)
      Description copied from interface: UiBackend
      Opens session's intent; reports through callbacks. For a Grid it shows GridSession.current() as it is at this call, which may already differ from the intent.
      Specified by:
      open in interface UiBackend
      Type Parameters:
      R - answer type
    • update

      public void update(GridSession session, Grid previous, Grid next)
      Description copied from interface: UiBackend
      Shows next instead of previous on a grid this backend opened, before returning. previous is the snapshot this backend was last given (by open or update). Called only while the session is open. A backend that cannot change the title of a shown screen may reopen it to show a new title; that does not end the session.
      Specified by:
      update in interface UiBackend
    • redraw

      public void redraw(GridSession session, Map<GridSlot, org.bukkit.inventory.ItemStack> picture)
      Description copied from interface: BoundSlotRenderer
      Draws picture (copies) on session's screen. Called in the viewer's entity task.
      Specified by:
      redraw in interface BoundSlotRenderer
    • close

      public void close(UiSession<?> session)
      Description copied from interface: UiBackend
      Closes the screen of session if this backend opened it and it is still showing; called at most once per opened session, after the outcome is chosen and before the result completes. Called in a task of the viewer's entity context; in a task of the global context if the viewer has quit, when the screen is already gone and the backend must only release its own bookkeeping; or on the unloading thread during owner unload.
      Specified by:
      close in interface UiBackend
    • render

      private void render(ChestScreen screen, Grid grid)
    • item

      private org.bukkit.inventory.ItemStack item(Grid grid, GridSlot slot, org.bukkit.entity.Player viewer)
    • put

      private static void put(org.bukkit.inventory.Inventory inventory, GridSlot slot, org.bukkit.inventory.ItemStack item)