Skip to content

API reference / @jsprismarine/prismarine / player/context/HandlerContext

player/context/HandlerContext ​

Interfaces ​

HandlerServices ​

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:66

The server-wide services an input-lane handler may use, each narrowed to the members handlers call. Each runs to its end in the handler's unit and hands back a promise only for what it leaves to the transport or the disk. A service that writes a file changes memory at once and writes the file off the tick.

Properties ​

chat ​

readonly chat: Pick<ChatManager, "send">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:92

Chat fan-out, which calls the plugins' chat listeners as it is called; what an asynchronous listener does after its first wait runs after the input.

commands ​

readonly commands: Pick<CommandManager, "runCommand">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:87

The command dispatcher. runCommand runs a command in the handler's unit and hands back what the command started, which the handler gives to InputStep.output.

console ​

readonly console: ConsoleSender

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:101

The console, as the sender of a server-issued line.

content ​

readonly content: ServerContent

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:68

The content registries: items, blocks, recipes and enchantments.

contentWorld ​

readonly contentWorld: Pick<ServerWorldHandle, "actorsAt">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:70

The item actors of each dimension, which the content interactions read.

creativeInventory ​

readonly creativeInventory: Pick<CreativeInventory, "get" | "getGroups" | "getEntries">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:75

The creative inventory, for a creative pick the content payloads do not answer and the join's menu when no payloads were built.

defaults ​

readonly defaults: Pick<Config, "setGamemode">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:113

The server's default game mode, which SetDefaultGameType changes. It changes in memory at once, and the config file is written off the tick.

events ​

readonly events: Pick<ServerEventBus, "post">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:103

The plugin events a handler raises.

intents ​

readonly intents: Pick<IntentHandlerRegistry, "handle">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:108

The intent handlers, built-in and plugin, for a handler that turns part of a packet into an intent the way a decoder would.

messages ​

readonly messages: Pick<WorldMessages, "send">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:99

Changes for another world, which its input step applies. A handler applies an input in the sender's world and files what it changes anywhere else here.

permissions ​

readonly permissions: Pick<PermissionManager, "isOp" | "setOpNow" | "can">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:82

The operator list and permission checks. setOpNow changes the list in memory and writes the operator file off the tick.

random ​

readonly random: Random

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:124

The server's random source, a draw in [0, 1), for a handler whose outcome is a roll, such as the experience a grindstone gives back. A replay restores the same stream.

replicators ​

readonly replicators: Pick<WorldReplicators, "for">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:94

The per-world replicators, for a handler that relays a packet to the players near a point.

resourcePacks ​

readonly resourcePacks: Pick<ServedResourcePacks, "offered" | "find" | "chosenSubpack">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:119

The resource packs the server offers, which a client downloads before it joins.

scriptForms ​

readonly scriptForms: ScriptFormInbox

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:115

Where a client's answer to a behavior pack script's form goes.

sessions ​

readonly sessions: Pick<SessionManager, "getSessions" | "sessionOf" | "getPlayerList">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:77

The other sessions on the server, and the player list.

updates ​

readonly updates: Pick<Updates, "welcome">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:117

The update checks, which tell a player who just spawned about a newer build.


InputContext ​

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:158

What an input-lane handler is handed.

Extends ​

Properties ​

config ​

readonly config: HandlerConfig

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:57

The settings the handler may read.

Inherited from ​

SessionContext.config

log ​

readonly log: HandlerLog

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:55

Where the handler logs.

Inherited from ​

SessionContext.log

services ​

readonly services: HandlerServices

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:160

The server-wide services the handler may use.

session ​

readonly session: PlayerSession

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:53

The session the packet arrived on.

Inherited from ​

SessionContext.session

step ​

readonly step: InputStep

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:162

The input step that applies the input.


InputStep ​

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:143

The hooks of the input step that applies an input.

Properties ​

tick ​

readonly tick: number

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:145

The tick whose input step applies the input.

Methods ​

output() ​

output(send): void

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:154

Hands the step something the handler started and does not wait for: a send whose packets are already queued, or what a command left running, such as a kick. The step lets it finish outside the tick and reports a failure as the handler's. The handler's writes are committed by then, so a failed send does not undo them.

Parameters ​
send ​

Promise<void>

The send, already started.

Returns ​

void


ScriptFormInbox ​

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:128

The behavior pack scripts' side of a form a client answers.

Methods ​

answerDataDriven() ​

answerDataDriven(response): boolean

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:139

Hands the scripts a client's write to, or close of, a data-driven screen, which their next flush applies.

Parameters ​
response ​

DataDrivenResponse

Returns ​

boolean

Whether any scripts run to take it.

answerForm() ​

answerForm(response): boolean

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:133

Hands the scripts an answer, which their next flush settles the form with.

Parameters ​
response ​

ScriptFormResponse

Returns ​

boolean

Whether any scripts run to take it.


ServerLaneContexts ​

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:166

The context the server hands each lane's handlers.

Properties ​

connection ​

readonly connection: SessionContext

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:167

input ​

readonly input: InputContext

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:169

read ​

readonly read: SessionContext

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:168


SessionContext ​

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:51

What every handler of a player session is handed, and all a connection-lane or read-lane one gets.

Extended by ​

Properties ​

config ​

readonly config: HandlerConfig

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:57

The settings the handler may read.

log ​

readonly log: HandlerLog

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:55

Where the handler logs.

session ​

readonly session: PlayerSession

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:53

The session the packet arrived on.

Type Aliases ​

HandlerConfig ​

HandlerConfig = Pick<Config, "getViewDistance" | "getDifficulty" | "setDifficulty" | "getGamemode" | "getServerAuthoritativeBlockBreaking" | "getEducationFeatures" | "getCraftingRecipeLimit" | "getPacketCompressionLevel" | "getKeepAliveIntervalMs" | "getBedrockKeepAliveTimeoutMs" | "getTexturepackRequired" | "getXboxAchievements">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:34

The server settings a handler may read.


HandlerLog ​

HandlerLog = Pick<Logger, "silly" | "debug" | "verbose" | "info" | "warn" | "error">

Defined in: packages/prismarine/src/player/context/HandlerContext.ts:31

The logger levels a handler writes at.