Interface UiBackend
- All Known Implementing Classes:
ChestBackend, DialogBackend
@Internal
public interface UiBackend
A rendering backend. Framework-internal in 7.0: modules do not implement it.
Selection: among registered backends whose supports(UiIntent, Player) returns true, the one
with the highest priority() opens the intent. Priorities are unique: registering a backend whose
priority equals that of an already registered backend fails with IllegalStateException, whatever
intents the two support, so selection never depends on registration order. The framework registers its
backends at start-up, so a clash is a start-up error.
The service calls supports, open and update in a task of the viewer's entity
context; close as stated on close(UiSession). It never calls a backend for a session whose
outcome has already been delivered.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceHow a backend reports back. -
Method Summary
Modifier and TypeMethodDescriptionvoidCloses the screen ofsessionif 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.net.kyori.adventure.key.Keyid()Unique backend identity.<R> voidopen(UiSession<R> session, UiBackend.BackendCallbacks<R> callbacks) Openssession's intent; reports throughcallbacks.intpriority()Higher wins; unique among registered backends.booleanWhether this backend can showintenttoviewernow.voidupdate(GridSession session, Grid previous, Grid next) Showsnextinstead ofpreviouson a grid this backend opened, before returning.
-
Method Details
-
id
net.kyori.adventure.key.Key id()Unique backend identity. -
priority
int priority()Higher wins; unique among registered backends. Framework values: Dialog 100, chest 0. -
supports
Whether this backend can showintenttoviewernow. May depend on the intent's content (for example the inputs of a form) and on the viewer (for example client capabilities). -
open
Openssession's intent; reports throughcallbacks. For aGridit showsGridSession.current()as it is at this call, which may already differ from the intent.- Type Parameters:
R- answer type
-
update
Showsnextinstead ofpreviouson a grid this backend opened, before returning.previousis the snapshot this backend was last given (byopenorupdate). 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. -
close
Closes the screen ofsessionif 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.
-