Class DialogBackend

java.lang.Object
com.ultikits.ultitools.ui.dialog.DialogBackend
All Implemented Interfaces:
UiBackend

@Internal public final class DialogBackend extends Object implements UiBackend
Paper Dialog renderer for notices, confirmations, forms and choices.
  • Field Details

  • Constructor Details

  • Method Details

    • paper

      public static DialogBackend paper(Messages messages, Logger logger, Function<? super UiSession<?>, String> ownerNames)
      Creates the Paper presenter without registering it or constructing any registry objects.
    • 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
    • representable

      private static boolean representable(SliderInput slider)
      Bounds the float spacing at the largest absolute endpoint, including negative and zero-crossing ranges. Requiring ULP <= step / 2 bounds nearest-float rounding error by step / 4, leaving a margin before the contract's half-step snap boundary. Equality is accepted; a larger ULP rejects the whole range even when its endpoints and initial value happen to be exactly representable. Endpoint and initial casts are also checked explicitly, and a non-finite or zero float step remains unsupported.
    • representable

      private static boolean representable(double value, double tolerance)
    • 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
    • interrupt

      public void interrupt(org.bukkit.entity.Player player)
      Reports game-driven dismissal only for this backend's shown dialogs, on the server thread.
    • 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
    • close

      public void close(UiSession<?> session)
      Dismisses only a successfully shown, unanswered screen. Paper provides no dialog replacement signal: if another plugin has since shown its own dialog, our later timeout dismissal also closes that dialog.
      Specified by:
      close in interface UiBackend