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
readonlychat: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
readonlycommands: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
readonlyconsole:ConsoleSender
Defined in: packages/prismarine/src/player/context/HandlerContext.ts:101
The console, as the sender of a server-issued line.
content
readonlycontent:ServerContent
Defined in: packages/prismarine/src/player/context/HandlerContext.ts:68
The content registries: items, blocks, recipes and enchantments.
contentWorld
readonlycontentWorld: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
readonlycreativeInventory: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
readonlydefaults: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
readonlyevents:Pick<ServerEventBus,"post">
Defined in: packages/prismarine/src/player/context/HandlerContext.ts:103
The plugin events a handler raises.
intents
readonlyintents: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
readonlymessages: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
readonlypermissions: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
readonlyrandom: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
readonlyreplicators: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
readonlyresourcePacks: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
readonlyscriptForms: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
readonlysessions: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
readonlyupdates: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
readonlyconfig:HandlerConfig
Defined in: packages/prismarine/src/player/context/HandlerContext.ts:57
The settings the handler may read.
Inherited from
log
readonlylog:HandlerLog
Defined in: packages/prismarine/src/player/context/HandlerContext.ts:55
Where the handler logs.
Inherited from
services
readonlyservices:HandlerServices
Defined in: packages/prismarine/src/player/context/HandlerContext.ts:160
The server-wide services the handler may use.
session
readonlysession:PlayerSession
Defined in: packages/prismarine/src/player/context/HandlerContext.ts:53
The session the packet arrived on.
Inherited from
step
readonlystep: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
readonlytick: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
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
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
readonlyconnection:SessionContext
Defined in: packages/prismarine/src/player/context/HandlerContext.ts:167
input
readonlyinput:InputContext
Defined in: packages/prismarine/src/player/context/HandlerContext.ts:169
read
readonlyread: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
readonlyconfig:HandlerConfig
Defined in: packages/prismarine/src/player/context/HandlerContext.ts:57
The settings the handler may read.
log
readonlylog:HandlerLog
Defined in: packages/prismarine/src/player/context/HandlerContext.ts:55
Where the handler logs.
session
readonlysession: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.