Skip to content

API reference / @jsprismarine/management-protocol / ManagementServer

ManagementServer ​

Classes ​

Interfaces ​

ManagementLogger ​

Defined in: ManagementServer.ts:36

What a listener logs.

Methods ​

info() ​

info(message): void

Defined in: ManagementServer.ts:37

Parameters ​
message ​

string

Returns ​

void

warn() ​

warn(message): void

Defined in: ManagementServer.ts:38

Parameters ​
message ​

string

Returns ​

void


ManagementServerOptions ​

Defined in: ManagementServer.ts:42

How to start a listener.

Properties ​

allowedOrigins ​

readonly allowedOrigins: readonly string[]

Defined in: ManagementServer.ts:54

The Origin values a browser may connect from, as management-server-allowed-origins. Java checks the origin of a client that sends the secret as a subprotocol, which is what a browser has to do, and not of one that sends a bearer token.

handlers ​

readonly handlers: Handlers

Defined in: ManagementServer.ts:62

host ​

readonly host: string

Defined in: ManagementServer.ts:44

The address to listen on, as management-server-host.

logger? ​

readonly optional logger?: ManagementLogger

Defined in: ManagementServer.ts:65

notifications ​

readonly notifications: readonly (keyof Notifications)[]

Defined in: ManagementServer.ts:64

The notifications the server sends, which rpc.discover lists.

port ​

readonly port: number

Defined in: ManagementServer.ts:46

The port, as management-server-port; 0 picks a free one.

secret ​

readonly secret: string

Defined in: ManagementServer.ts:48

The secret every client must send.

started ​

readonly started: () => boolean

Defined in: ManagementServer.ts:59

Whether the server has started. Before it has, a client may only call rpc.discover, and the only notification sent is server/status, as on Java.

Returns ​

boolean

tls? ​

readonly optional tls?: object

Defined in: ManagementServer.ts:61

A PKCS12 keystore and its password, to serve wss://; omitted, the listener serves ws://.

passphrase? ​

readonly optional passphrase?: string

pfx ​

readonly pfx: Buffer

Type Aliases ​

Handler ​

Handler<K> = (params) => Methods[K]["result"] | Promise<Methods[K]["result"]>

Defined in: ManagementServer.ts:22

What one method's handler takes and returns, as Mojang's document types it.

Type Parameters ​

K ​

K extends keyof Methods

Parameters ​

params ​

Methods[K]["params"]

Returns ​

Methods[K]["result"] | Promise<Methods[K]["result"]>


Handlers ​

Handlers = { readonly [K in keyof Methods]?: Handler<K> }

Defined in: ManagementServer.ts:27

The methods a server implements, by name. A method left out is not found, and not discovered.

Variables ​

SUBPROTOCOL ​

const SUBPROTOCOL: "minecraft-v1" = 'minecraft-v1'

Defined in: ManagementServer.ts:33

The subprotocol a browser offers, with the secret after it, since it cannot set a header.

Functions ​

discoverDocument() ​

discoverDocument(handlers, notifications): object

Defined in: ManagementServer.ts:83

The rpc.discover result: Mojang's document cut down to the methods this server handles and the notifications it sends, with every component, so a client sees what it can use here.

Parameters ​

handlers ​

Handlers

notifications ​

readonly (keyof Notifications)[]

Returns ​

object

components ​

components: object

components.schemas ​

schemas: object

components.schemas.difficulty ​

difficulty: object

components.schemas.difficulty.enum ​

enum: string[]

components.schemas.difficulty.type ​

type: string = "string"

components.schemas.game_type ​

game_type: object

components.schemas.game_type.enum ​

enum: string[]

components.schemas.game_type.type ​

type: string = "string"

components.schemas.incoming_ip_ban ​

incoming_ip_ban: object

components.schemas.incoming_ip_ban.properties ​

properties: object

components.schemas.incoming_ip_ban.properties.expires ​

expires: object

components.schemas.incoming_ip_ban.properties.expires.type ​

type: string = "string"

components.schemas.incoming_ip_ban.properties.ip ​

ip: object

components.schemas.incoming_ip_ban.properties.ip.type ​

type: string = "string"

components.schemas.incoming_ip_ban.properties.player ​

player: object

components.schemas.incoming_ip_ban.properties.player.$ref ​

$ref: string = "#/components/schemas/player"

components.schemas.incoming_ip_ban.properties.reason ​

reason: object

components.schemas.incoming_ip_ban.properties.reason.type ​

type: string = "string"

components.schemas.incoming_ip_ban.properties.source ​

source: object

components.schemas.incoming_ip_ban.properties.source.type ​

type: string = "string"

components.schemas.incoming_ip_ban.type ​

type: string = "object"

components.schemas.ip_ban ​

ip_ban: object

components.schemas.ip_ban.properties ​

properties: object

components.schemas.ip_ban.properties.expires ​

expires: object

components.schemas.ip_ban.properties.expires.type ​

type: string = "string"

components.schemas.ip_ban.properties.ip ​

ip: object

components.schemas.ip_ban.properties.ip.type ​

type: string = "string"

components.schemas.ip_ban.properties.reason ​

reason: object

components.schemas.ip_ban.properties.reason.type ​

type: string = "string"

components.schemas.ip_ban.properties.source ​

source: object

components.schemas.ip_ban.properties.source.type ​

type: string = "string"

components.schemas.ip_ban.type ​

type: string = "object"

components.schemas.kick_player ​

kick_player: object

components.schemas.kick_player.properties ​

properties: object

components.schemas.kick_player.properties.message ​

message: object

components.schemas.kick_player.properties.message.$ref ​

$ref: string = "#/components/schemas/message"

components.schemas.kick_player.properties.player ​

player: object

components.schemas.kick_player.properties.player.$ref ​

$ref: string = "#/components/schemas/player"

components.schemas.kick_player.type ​

type: string = "object"

components.schemas.message ​

message: object

components.schemas.message.properties ​

properties: object

components.schemas.message.properties.literal ​

literal: object

components.schemas.message.properties.literal.type ​

type: string = "string"

components.schemas.message.properties.translatable ​

translatable: object

components.schemas.message.properties.translatable.type ​

type: string = "string"

components.schemas.message.properties.translatableParams ​

translatableParams: object

components.schemas.message.properties.translatableParams.items ​

items: object

components.schemas.message.properties.translatableParams.items.type ​

type: string = "string"

components.schemas.message.properties.translatableParams.type ​

type: string = "array"

components.schemas.message.type ​

type: string = "object"

components.schemas.operator ​

operator: object

components.schemas.operator.properties ​

properties: object

components.schemas.operator.properties.bypassesPlayerLimit ​

bypassesPlayerLimit: object

components.schemas.operator.properties.bypassesPlayerLimit.type ​

type: string = "boolean"

components.schemas.operator.properties.permissionLevel ​

permissionLevel: object

components.schemas.operator.properties.permissionLevel.type ​

type: string = "integer"

components.schemas.operator.properties.player ​

player: object

components.schemas.operator.properties.player.$ref ​

$ref: string = "#/components/schemas/player"

components.schemas.operator.type ​

type: string = "object"

components.schemas.player ​

player: object

components.schemas.player.properties ​

properties: object

components.schemas.player.properties.id ​

id: object

components.schemas.player.properties.id.type ​

type: string = "string"

components.schemas.player.properties.name ​

name: object

components.schemas.player.properties.name.type ​

type: string = "string"

components.schemas.player.type ​

type: string = "object"

components.schemas.server_state ​

server_state: object

components.schemas.server_state.properties ​

properties: object

components.schemas.server_state.properties.players ​

players: object

components.schemas.server_state.properties.players.items ​

items: object

components.schemas.server_state.properties.players.items.$ref ​

$ref: string = "#/components/schemas/player"

components.schemas.server_state.properties.players.type ​

type: string = "array"

components.schemas.server_state.properties.started ​

started: object

components.schemas.server_state.properties.started.type ​

type: string = "boolean"

components.schemas.server_state.properties.version ​

version: object

components.schemas.server_state.properties.version.$ref ​

$ref: string = "#/components/schemas/version"

components.schemas.server_state.type ​

type: string = "object"

components.schemas.system_message ​

system_message: object

components.schemas.system_message.properties ​

properties: object

components.schemas.system_message.properties.message ​

message: object

components.schemas.system_message.properties.message.$ref ​

$ref: string = "#/components/schemas/message"

components.schemas.system_message.properties.overlay ​

overlay: object

components.schemas.system_message.properties.overlay.type ​

type: string = "boolean"

components.schemas.system_message.properties.receivingPlayers ​

receivingPlayers: object

components.schemas.system_message.properties.receivingPlayers.items ​

items: object

components.schemas.system_message.properties.receivingPlayers.items.$ref ​

$ref: string = "#/components/schemas/player"

components.schemas.system_message.properties.receivingPlayers.type ​

type: string = "array"

components.schemas.system_message.type ​

type: string = "object"

components.schemas.typed_game_rule ​

typed_game_rule: object

components.schemas.typed_game_rule.properties ​

properties: object

components.schemas.typed_game_rule.properties.key ​

key: object

components.schemas.typed_game_rule.properties.key.type ​

type: string = "string"

components.schemas.typed_game_rule.properties.type ​

type: object

components.schemas.typed_game_rule.properties.type.enum ​

enum: string[]

components.schemas.typed_game_rule.properties.type.type ​

type: string = "string"

components.schemas.typed_game_rule.properties.value ​

value: object

components.schemas.typed_game_rule.properties.value.type ​

type: string[]

components.schemas.typed_game_rule.type ​

type: string = "object"

components.schemas.untyped_game_rule ​

untyped_game_rule: object

components.schemas.untyped_game_rule.properties ​

properties: object

components.schemas.untyped_game_rule.properties.key ​

key: object

components.schemas.untyped_game_rule.properties.key.type ​

type: string = "string"

components.schemas.untyped_game_rule.properties.value ​

value: object

components.schemas.untyped_game_rule.properties.value.type ​

type: string[]

components.schemas.untyped_game_rule.type ​

type: string = "object"

components.schemas.user_ban ​

user_ban: object

components.schemas.user_ban.properties ​

properties: object

components.schemas.user_ban.properties.expires ​

expires: object

components.schemas.user_ban.properties.expires.type ​

type: string = "string"

components.schemas.user_ban.properties.player ​

player: object

components.schemas.user_ban.properties.player.$ref ​

$ref: string = "#/components/schemas/player"

components.schemas.user_ban.properties.reason ​

reason: object

components.schemas.user_ban.properties.reason.type ​

type: string = "string"

components.schemas.user_ban.properties.source ​

source: object

components.schemas.user_ban.properties.source.type ​

type: string = "string"

components.schemas.user_ban.type ​

type: string = "object"

components.schemas.version ​

version: object

components.schemas.version.properties ​

properties: object

components.schemas.version.properties.name ​

name: object

components.schemas.version.properties.name.type ​

type: string = "string"

components.schemas.version.properties.protocol ​

protocol: object

components.schemas.version.properties.protocol.type ​

type: string = "integer"

components.schemas.version.type ​

type: string = "object"

info ​

info: object

info.title ​

title: string = "Minecraft Server JSON-RPC"

info.version ​

version: string = "3.1.0"

methods ​

methods: ({ description: string; name: string; params: object[]; result: { name: string; schema: { $ref?: undefined; items: { $ref: string; }; type: string; }; }; } | { description: string; name: string; params: object[]; result: { name: string; schema: { $ref?: undefined; items: { $ref: string; }; type: string; }; }; } | { description: string; name: string; params: object[]; result: { name: string; schema: { $ref?: undefined; items?: undefined; type: string; }; }; } | { description: string; name: string; params: object[]; result: { name: string; schema: { $ref?: undefined; items?: undefined; type: string; }; }; } | { description: string; name: string; params: object[]; result: { name: string; schema: { $ref: string; items?: undefined; type?: undefined; }; }; } | { description: string; name: string; params: object[]; result?: undefined; } | { description: string; name: string; params: object[]; result?: undefined; })[]

openrpc ​

openrpc: string = "1.3.2"


refusalOf() ​

refusalOf(headers, secret, allowedOrigins): Refusal | undefined

Defined in: ManagementServer.ts:133

Checks a client's handshake as Java does: a bearer token, with no origin check, or else the secret after minecraft-v1, in Sec-WebSocket-Protocol, from an allowed origin.

Parameters ​

headers ​

IncomingHttpHeaders

secret ​

string

allowedOrigins ​

readonly string[]

Returns ​

Refusal | undefined

Why the client is refused, or undefined to let it in.


rpcTable() ​

rpcTable(handlers, notifications, started, onInternalError?): RpcTable

Defined in: ManagementServer.ts:100

The dispatcher table for a set of handlers, with rpc.discover.

Parameters ​

handlers ​

Handlers

The methods the server implements.

notifications ​

readonly (keyof Notifications)[]

The notifications it sends.

started ​

() => boolean

onInternalError? ​

(method, error) => void

Returns ​

RpcTable

The table answerFrame reads.