Skip to content

API reference / @jsprismarine/prismarine / Config

Class: Config ​

Defined in: prismarine/src/config/Config.ts:236

Constructors ​

Constructor ​

new Config(options?): Config

Defined in: prismarine/src/config/Config.ts:325

Creates the server configuration.

Parameters ​

options? ​

ConfigOptions = {}

runtime values that override settings in the server config file.

Returns ​

Config

Methods ​

getChunkHost() ​

getChunkHost(): "process" | "in-process"

Defined in: prismarine/src/config/Config.ts:601

Where chunk generation workers run.

process, the default, starts a separate generation process at a lowered operating system priority and falls back to threads in the server process when it cannot. in-process keeps the threads in the server process. Any other value is treated as the default.

Returns ​

"process" | "in-process"

process or in-process


getChunkSendBudgetMs() ​

getChunkSendBudgetMs(): number

Defined in: prismarine/src/config/Config.ts:633

How long a tick may spend sending chunks, out of the 50 ms it has.

The dial between how responsive the server stays and how fast the world appears. Raising it loads chunks quicker at the cost of everything else the tick does.

Returns ​

number

The budget in milliseconds


getChunkWorkers() ​

getChunkWorkers(): number

Defined in: prismarine/src/config/Config.ts:587

How many worker threads chunk generation may use.

Zero keeps generation on the server thread. The default reserves two cores for the server and caps the rest at the number already measured to help generation.

Returns ​

number

A nonnegative integer worker count


getCraftingRecipeLimit() ​

getCraftingRecipeLimit(): number

Defined in: prismarine/src/config/Config.ts:808

How many recipes to send: -1 for every one, 0 for none, a positive number to cap.

The crafting-recipe-limit config key, truncated to a whole number. This is how PlayerSession.sendCraftingData reads it; the field above says why the two escape hatches exist.

Returns ​

number

the limit.


getDifficulty() ​

getDifficulty(): Difficulty

Defined in: prismarine/src/config/Config.ts:508

How dangerous the monsters are.

Named in the file rather than numbered, as the gamemode is, because difficulty: 2 in a config nobody can read is how a server ends up on the wrong one. An unrecognized name falls back to normal instead of refusing to start - a typo should not take a server down.

Returns ​

Difficulty

The configured difficulty.


getEnableLanVisibility() ​

getEnableLanVisibility(): boolean

Defined in: prismarine/src/config/Config.ts:732

Whether the server answers clients looking for games on the local network.

Returns ​

boolean


getEnableNetherNet() ​

getEnableNetherNet(): boolean

Defined in: prismarine/src/config/Config.ts:709

Whether the server accepts clients over NetherNet.

Returns ​

boolean


getEnableProcessTitle() ​

getEnableProcessTitle(): boolean

Defined in: prismarine/src/config/Config.ts:792

Returns ​

boolean


getEnableQuery() ​

getEnableQuery(): boolean

Defined in: prismarine/src/config/Config.ts:770

Whether the server answers the GameSpy4 query protocol.

Returns ​

boolean


getEnableRakNet() ​

getEnableRakNet(): boolean

Defined in: prismarine/src/config/Config.ts:699

Whether the server accepts clients over RakNet.

Returns ​

boolean


getEnableServerPublicIpLookup() ​

getEnableServerPublicIpLookup(): boolean

Defined in: prismarine/src/config/Config.ts:727

Whether NetherNet looks up the server's public address when server-public-ip is empty, and offers it to a player joining by address whose answer would otherwise carry no public address.

Returns ​

boolean


getEnableTicking() ​

getEnableTicking(): boolean

Defined in: prismarine/src/config/Config.ts:796

Returns ​

boolean


getEntityTrackingHysteresis() ​

getEntityTrackingHysteresis(): number

Defined in: prismarine/src/config/Config.ts:672

Chunks past a viewer's own reach before a tracked entity is taken off their screen.

The gap between the radius at which an entity appears and the one at which it goes away. Without a gap, a player standing on the boundary makes every entity out there appear and disappear on alternating passes.

Returns ​

number

The hysteresis in chunks, as an integer


getEntityTrackingInterval() ​

getEntityTrackingInterval(): number

Defined in: prismarine/src/config/Config.ts:685

Ticks between entity visibility passes.

Only governs entities moving towards a standing player - a player who moves crosses a chunk boundary and forces a pass regardless. Entity types that declare a longer interval of their own keep it; this is the floor.

Returns ​

number

The interval in ticks, at least 1


getGamemode() ​

getGamemode(): string

Defined in: prismarine/src/config/Config.ts:496

Returns ​

string


getInvalidChunkHost() ​

getInvalidChunkHost(): string | undefined

Defined in: prismarine/src/config/Config.ts:611

The configured chunk-host when it is neither process nor in-process, so the server can say so instead of quietly using the default.

Returns ​

string | undefined

The rejected value, or undefined when the setting is valid.


getLevelName() ​

getLevelName(): string

Defined in: prismarine/src/config/Config.ts:464

Returns the default world's name (id).

Returns ​

string

The world's name as a string

Remarks ​

If the world doesn't exist as a part of the worlds array the worldManager will fail to initialize.


getLogExcludedPackets() ​

getLogExcludedPackets(): string[]

Defined in: prismarine/src/config/Config.ts:816

Packet class names kept out of the traffic log.

Returns ​

string[]

the excluded names.


getLogLevel() ​

getLogLevel(): "warn" | "error" | "info" | "verbose" | "debug" | "silly"

Defined in: prismarine/src/config/Config.ts:424

Returns ​

"warn" | "error" | "info" | "verbose" | "debug" | "silly"


getMaxPlayers() ​

getMaxPlayers(): number

Defined in: prismarine/src/config/Config.ts:492

Returns ​

number

The max amount of players allowed onto the server at the same time.


getMotd() ​

getMotd(): string

Defined in: prismarine/src/config/Config.ts:542

Returns true or false depending on if online mode is enabled.

Returns ​

string

The message of the day as a string


getOnlineMode() ​

getOnlineMode(): boolean

Defined in: prismarine/src/config/Config.ts:694

Returns true or false depending on if online mode is enabled.

Returns ​

boolean

true if enabled, false otherwise


getPacketCompressionAlgorithm() ​

getPacketCompressionAlgorithm(): PacketCompressionAlgorithm

Defined in: prismarine/src/config/Config.ts:748

The algorithm selected for new connections. Each NetworkSettings packet advertises it, and the connection stores the same value for all later batches.

Returns ​

PacketCompressionAlgorithm


getPacketCompressionLevel() ​

getPacketCompressionLevel(): number

Defined in: prismarine/src/config/Config.ts:740

The zlib level batches are compressed at, clamped to what zlib will actually accept. See toPacketCompressionLevel for why the configured value is not trusted as is.

Returns ​

number


getPacketCompressionThreshold() ​

getPacketCompressionThreshold(): number

Defined in: prismarine/src/config/Config.ts:760

The minimum uncompressed batch-body size that is compressed and advertised to clients.

Returns ​

number


getPacketFullFlushFragments() ​

getPacketFullFlushFragments(): boolean

Defined in: prismarine/src/config/Config.ts:765

Whether the unvalidated full-flush batch prototype is enabled for shared movement, blocks, and chunks.

Returns ​

boolean


getPreloadRadius() ​

getPreloadRadius(): number

Defined in: prismarine/src/config/Config.ts:575

How many chunks around spawn are generated before the server accepts players.

A radius of r generates (2r+1)^2 chunks, so the default 10 is 441 - about what the first player will see. Zero skips the preload entirely and generates on demand.

Returns ​

number

The preload radius in chunks, as an integer


getProximityBroadcast() ​

getProximityBroadcast(): boolean

Defined in: prismarine/src/config/Config.ts:646

Whether positional packets are narrowed to the players near them.

An escape hatch rather than a feature dial. Turning it off makes every positional broadcast reach every player in the same world - it does not restore the server-wide fan-out some of them used to have, which was a bug and not a behavior.

Returns ​

boolean

Whether proximity filtering is on


getQueryPort() ​

getQueryPort(): number

Defined in: prismarine/src/config/Config.ts:780

The UDP port the query protocol answers on, as Java Edition's query.port. When it is the same as getServerPort, query answers on the RakNet socket beside the game, which is what an unset one does; any other port gets a socket of its own.

Returns ​

number

The query port.


getQueryPortSetting() ​

getQueryPortSetting(): number | undefined

Defined in: prismarine/src/config/Config.ts:788

query-port as the config sets it.

Returns ​

number | undefined

The port, or undefined when query answers on the port the server binds.


getServerAuthoritativeBlockBreaking() ​

getServerAuthoritativeBlockBreaking(): boolean

Defined in: prismarine/src/config/Config.ts:659

Who decides when a block a player is mining breaks.

On, the default and what a Bedrock Dedicated Server 1.26.52 announces: the server animates the cracks every tick, and the client reports a break it predicts, which the server carries out. Off, the client times the break itself and reports it once it is done.

Returns ​

boolean

Whether block breaking is server-authoritative


getServerIp() ​

getServerIp(): string

Defined in: prismarine/src/config/Config.ts:453

Get the server's IP address.

Returns ​

string

The server's IP address

Remarks ​

The default IP address is 0.0.0.0


getServerPort() ​

getServerPort(): number

Defined in: prismarine/src/config/Config.ts:433

Get the server's port.

Returns ​

number

The server's port

Remarks ​

The default port is 19132.


getServerPortV6() ​

getServerPortV6(): number

Defined in: prismarine/src/config/Config.ts:444

The UDP port RakNet listens on for IPv6 clients, as Bedrock Dedicated Server's server-portv6. Only a server bound to the IPv4 wildcard, 0.0.0.0, also listens on IPv6: an operator who named one IPv4 interface asked for that interface alone.

Returns ​

number

The IPv6 port.

Remarks ​

The default port is 19133, where Bedrock clients look for it.


getServerPublicIp() ​

getServerPublicIp(): string

Defined in: prismarine/src/config/Config.ts:719

The address NetherNet advertises, unparsed: a raw IPv4, a raw or bracketed IPv6, or empty.

Returns ​

string


getServerUdpPorts() ​

getServerUdpPorts(): string

Defined in: prismarine/src/config/Config.ts:714

The NetherNet UDP ports setting, unparsed, in Bedrock Dedicated Server's syntax; empty means the server port.

Returns ​

string


getTerrainCacheSizeMb() ​

getTerrainCacheSizeMb(): number

Defined in: prismarine/src/config/Config.ts:620

How many megabytes of generated terrain tiles the server keeps on disk.

Returns ​

number

A nonnegative integer; zero turns the cache off


getUseRakNetWorker() ​

getUseRakNetWorker(): boolean

Defined in: prismarine/src/config/Config.ts:704

Whether RakNet UDP I/O and reliability updates run outside the game thread.

Returns ​

boolean


getViewDistance() ​

getViewDistance(): number

Defined in: prismarine/src/config/Config.ts:563

Returns the view distance.

Returns ​

number

The view distance as an integer


getWorlds() ​

getWorlds(): Record<string, WorldData>

Defined in: prismarine/src/config/Config.ts:468

Returns ​

Record<string, WorldData>


setDifficulty() ​

setDifficulty(difficulty, commit?): void

Defined in: prismarine/src/config/Config.ts:531

Set how dangerous the monsters are.

Stored by name, as the file spells it, so getDifficulty reads back what was set rather than a second copy of the number.

Parameters ​

difficulty ​

Difficulty

the difficulty

commit? ​

boolean = false

if the value should be written to the config.json file

Returns ​

void


setGamemode() ​

setGamemode(gamemode, commit?): void

Defined in: prismarine/src/config/Config.ts:518

Set the default gamemode.

Parameters ​

gamemode ​

number

the gamemode

commit? ​

boolean = false

whether to write the value to the server config file

Returns ​

void


setMotd() ​

setMotd(motd, commit?): void

Defined in: prismarine/src/config/Config.ts:552

Set the motd.

Parameters ​

motd ​

string

the gamemode

commit? ​

boolean = false

whether to write the value to the server config file

Returns ​

void


setWorld() ​

setWorld(name, data, commit?): void

Defined in: prismarine/src/config/Config.ts:483

Replaces one worlds entry, which is how an entry read in the old generator and layers spelling is written back as preset and dimensions so the file converges.

The whole worlds map is rewritten, because the file keeps its top-level keys and their comments but a replaced map loses the comments inside it. Nothing else in the file moves.

Parameters ​

name ​

string

The world's key under worlds.

data ​

WorldData

The entry to store, normally from worldDataOf.

commit? ​

boolean = false

Whether to write the map to the config file.

Returns ​

void

Lifecycle ​

disable() ​

disable(): Promise<void>

Defined in: prismarine/src/config/Config.ts:422

On disable hook.

Returns ​

Promise<void>


enable() ​

enable(): Promise<void>

Defined in: prismarine/src/config/Config.ts:339

On enable hook.

Reads every setting, writing the default and its comment into the file for any key the file does not have yet. A file from an older version therefore gains the new keys, explained, without losing anything a person wrote in it.

Returns ​

Promise<void>