Class RuntimeGridSession

java.lang.Object
com.ultikits.ultitools.ui.runtime.RuntimeSession<Ack>
com.ultikits.ultitools.ui.runtime.RuntimeGridSession
All Implemented Interfaces:
GridSession, UiSession<Ack>

@Internal final class RuntimeGridSession extends RuntimeSession<Ack> implements GridSession
Separates the module's latest snapshot from the backend's rendered snapshot.
  • Field Details

    • current

      private Grid current
    • rendered

      private Grid rendered
    • picture

      private Map<GridSlot, org.bukkit.inventory.ItemStack> picture
    • updateQueued

      private boolean updateQueued
    • attached

      private final Set<SlotContainer> attached
  • Constructor Details

    • RuntimeGridSession

      RuntimeGridSession(RuntimeUiService service, org.bukkit.entity.Player viewer, Grid grid)
  • Method Details

    • current

      public Grid current()
      Description copied from interface: GridSession
      The snapshot currently shown.
      Specified by:
      current in interface GridSession
    • renderedLocked

      Grid renderedLocked()
    • update

      public void update(Grid next)
      Description copied from interface: GridSession
      Replaces the snapshot: GridSession.current() returns next as soon as this returns. The backend is told in a later task of the viewer's entity context, never inside this call; several updates made before that task may reach the backend as one, the latest. A click runs the action of the snapshot the backend had last been given when the click was reported (see GridAction). The title may change; a backend may reopen the screen to show it, which does not end the session. Does nothing once the session is not open (UiSession.isOpen()).
      Specified by:
      update in interface GridSession
    • validateContainers

      static void validateContainers(Grid grid)
    • boundContainers

      static Set<SlotContainer> boundContainers(Grid grid)
    • takeBindings

      void takeBindings()
      Overrides:
      takeBindings in class RuntimeSession<Ack>
    • attachBindings

      private void attachBindings(Grid snapshot)
    • detachBindings

      void detachBindings()
      Overrides:
      detachBindings in class RuntimeSession<Ack>
    • detachExcept

      private void detachExcept(Set<SlotContainer> retained)
    • notifyBackend

      private void notifyBackend()
    • drawPicture

      void drawPicture()
    • pictureCopy

      Map<GridSlot, org.bukkit.inventory.ItemStack> pictureCopy()
    • redraw

      void redraw()
    • renderPicture

      void renderPicture()
    • clicked

      void clicked(GridSlot slot, ClickKind kind)
      Overrides:
      clicked in class RuntimeSession<Ack>
    • runAction

      private void runAction(GridAction action, GridSlot slot, ClickKind kind)