Class StatefulDeclarativeGui<T extends StatefulDeclarativeGui<T>.State>

java.lang.Object
com.ultikits.ultitools.abstracts.gui.declarative.engine.DeclarativeGui
com.ultikits.ultitools.abstracts.gui.declarative.engine.StatefulDeclarativeGui<T>
Type Parameters:
T - the State type

public abstract class StatefulDeclarativeGui<T extends StatefulDeclarativeGui<T>.State> extends DeclarativeGui
StatefulDeclarativeGui is the base class for a declarative GUI that carries state.

It manages a State object internally, providing setState(Runnable) to trigger a rebuild.

  • Field Details

  • Constructor Details

    • StatefulDeclarativeGui

      protected StatefulDeclarativeGui(UiService ui, Scheduler scheduler, org.bukkit.entity.Player viewer, String id, Text title, int rows)
      Parameters:
      ui - the screen owner's UI service
      scheduler - the module's own injected scheduler
      viewer - the viewer
      id - the build-context identifier
      title - deferred screen title
      rows - fixed row count, 1..6
  • Method Details

    • createState

      @NotNull protected abstract T createState()
      Creates the state object.
      Returns:
      the state object
    • getState

      @NotNull protected T getState()
      Gets the state object.
      Returns:
      the state object
    • setState

      protected void setState(@NotNull @NotNull Runnable action)
      Sets state and triggers a rebuild.
      Overrides:
      setState in class DeclarativeGui
      Parameters:
      action - the state-modifying operation