Class RuntimeUiService
java.lang.Object
com.ultikits.ultitools.ui.runtime.RuntimeUiService
- All Implemented Interfaces:
ContainerHost, UiService
One module copy's view of the shared session registry and item-delivery lifecycle.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classRecords each successful write before attempting another, so a failure reports only the remaining items.private final class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final UiOwnerprivate final List<RuntimeUiService.PendingDelivery> (package private) final UiRuntime(package private) boolean(package private) boolean(package private) @Nullable Thread -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static org.bukkit.inventory.ItemStackamount(org.bukkit.inventory.ItemStack item, int count) voidchanged(SlotContainer container) Contents or state ofcontainerchanged: redraw every session that shows it before the next tick ends.container(ContainerSpec spec) A new container owned by this module.private static List<org.bukkit.inventory.ItemStack> Givesitemstoplayer: into the storage slots of their inventory (never armour or off-hand), the rest dropped at their feet.(package private) voidprivate <R> RuntimeSession<R> newSession(org.bukkit.entity.Player viewer, UiIntent<R> intent) owner()Owning module's name, for diagnostics.Returns items to a contributor through UiService#deliver semantics (offline: all undelivered).The scheduler the runtime uses (tests: the RecordingScheduler wrapper).Shows a grid with intent-dependent defaults.show(org.bukkit.entity.Player viewer, Grid grid, ShowOptions options) Shows a grid with explicit options.<R> UiSession<R> Shows an intent with intent-dependent defaults.<R> UiSession<R> show(org.bukkit.entity.Player viewer, UiIntent<R> intent, ShowOptions options) Shows an intent with explicit options.private static Deliveryundelivered(List<org.bukkit.inventory.ItemStack> items) voidLogsrecord(WARNING or higher, message already naming the owner) through the runtime's logger.
-
Field Details
-
runtime
-
ownerIdentity
-
unloaded
boolean unloaded -
unloading
boolean unloading -
unloadingThread
-
pendingDeliveries
-
-
Constructor Details
-
RuntimeUiService
-
-
Method Details
-
owner
-
show
-
show
Description copied from interface:UiServiceShows a grid with intent-dependent defaults. -
show
Description copied from interface:UiServiceShows a grid with explicit options. -
show
-
newSession
-
container
Description copied from interface:UiServiceA new container owned by this module. Call on the server thread (the container's thread). -
deliver
public CompletionStage<Delivery> deliver(org.bukkit.entity.Player player, List<org.bukkit.inventory.ItemStack> items) Description copied from interface:UiServiceGivesitemstoplayer: into the storage slots of their inventory (never armour or off-hand), the rest dropped at their feet. Runs in a task of the player's entity context; if that task cannot run because the player has quit, or the player is offline when it runs, nothing is given and every item not yet given is inDelivery.undelivered(). During the owner's unload, a call on the unloading thread gives at once, before it returns; a call from another thread during the unload, or any call after it, gives nothing and returns a stage already completed with every item undelivered. The stage always completes normally, exactly once. May be called from any thread. -
flushDeliveries
void flushDeliveries() -
returnTo
public CompletionStage<Delivery> returnTo(UUID contributor, List<org.bukkit.inventory.ItemStack> items) Description copied from interface:ContainerHostReturns items to a contributor through UiService#deliver semantics (offline: all undelivered).- Specified by:
returnToin interfaceContainerHost
-
changed
Description copied from interface:ContainerHostContents or state ofcontainerchanged: redraw every session that shows it before the next tick ends.- Specified by:
changedin interfaceContainerHost
-
warn
Description copied from interface:ContainerHostLogsrecord(WARNING or higher, message already naming the owner) through the runtime's logger.- Specified by:
warnin interfaceContainerHost
-
scheduler
Description copied from interface:ContainerHostThe scheduler the runtime uses (tests: the RecordingScheduler wrapper).- Specified by:
schedulerin interfaceContainerHost
-
copyItems
-
undelivered
-
amount
private static org.bukkit.inventory.ItemStack amount(org.bukkit.inventory.ItemStack item, int count)
-