PaperScreens

Public entry point supplied by the installed Strata plugin. Consumers declare a plugin dependency on Strata and invoke player operations on Paper's primary thread or the player's Folia region. The owner plugin controls the screen lifetime; its disable event closes every screen it owns.

Functions

Link copied to clipboard
fun capabilities(player: Player): RemoteCapabilities?

Returns negotiated client schemas and limits, or null before negotiation or after disconnect.

Link copied to clipboard
fun <T> execute(player: Player, operation: () -> T): T

Updates or reads caller-retained UI state under the player's owner from an existing entity-region callback. This call is synchronous and does not schedule work; asynchronous callers must first use the player's scheduler. Do not share owner-confined UI state between players or capture it from another physical thread.

Link copied to clipboard
fun open(ownerPlugin: Plugin, player: Player, definition: ScreenDefinition): RemoteScreenSession

Consumes one screen definition and replaces the player's previous Strata screen. Unavailable clients and unsupported declarations return a terminal handle with a typed reason. On Folia, create captured mutable state through execute, or use the definition-factory overload.

fun open(ownerPlugin: Plugin, player: Player, definition: () -> ScreenDefinition): RemoteScreenSession

Creates state and a definition within the player's UI owner, preserving it across Folia region migrations. Call on the player's region (or Paper's primary thread), and construct mutable UI state inside definition. The factory runs synchronously once, before retained screen evaluation; handlers run on that player's region.

Link copied to clipboard
fun register(ownerPlugin: Plugin, type: ProjectionType)

Registers a plugin-owned component, modifier, Canvas renderer, or semantics role schema before player negotiation. Declaration projections supply typed encoders and handlers; clients separately install matching decoders and factories. Existing connections retain their negotiated snapshot and must reconnect to use newly registered types. Disabling the owner withdraws its types and closes screens that require them.