API reference / @jsprismarine/prismarine / config/Config
config/Config
Classes
Interfaces
ConfigOptions
Defined in: prismarine/src/config/Config.ts:197
Runtime settings that take precedence over values in the server config file.
Properties
serverPort?
optionalserverPort?:number
Defined in: prismarine/src/config/Config.ts:199
Port the server listens on.
Type Aliases
OptionalSetting
OptionalSetting = typeof
OPTIONAL_SETTINGS[number]
Defined in: prismarine/src/config/Config.ts:116
A setting a fresh config leaves out; see OPTIONAL_SETTINGS.
Variables
DIFFICULTIES
constDIFFICULTIES:Readonly<Record<string,Difficulty>>
Defined in: prismarine/src/config/Config.ts:21
The difficulty names a config file may use, as the protocol numbers them.
OPTIONAL_SETTINGS
constOPTIONAL_SETTINGS: readonly ["server-udp-ports","server-public-ip","query-port"]
Defined in: prismarine/src/config/Config.ts:109
Settings a fresh config leaves out. Each is read when the file has it, and reading one writes nothing, so an unset one keeps following the setting it defaults to, such as server-port.
Functions
configFilePath()
configFilePath():
string
Defined in: prismarine/src/config/Config.ts:18
Returns the path to the server's JSON configuration file.
Returns
string
difficultyName()
difficultyName(
difficulty):string
Defined in: prismarine/src/config/Config.ts:35
The name a difficulty is spelled by, read back out of DIFFICULTIES so the two directions cannot disagree.
Parameters
difficulty
The protocol number.
Returns
string
The name, or normal for a number no name maps onto.
optionalSettings()
optionalSettings(): readonly
object[]
Defined in: prismarine/src/config/Config.ts:122
The settings a fresh config leaves out, each with the comment it gets once written.
Returns
readonly object[]
The settings, in the order the file would list them.
toPacketCompressionLevel()
toPacketCompressionLevel(
raw):number
Defined in: prismarine/src/config/Config.ts:214
Clamps a configured zlib level to the range zlib accepts.
zlib takes -1 (its own default) through 9 and errors on anything else. The value comes straight out of a hand edited config file, and an unchecked 10 reached deflate as a rejection on the chunk sending path, which is nowhere near where the typo was, and used to take the server's tick down with it. Clamping keeps a bad number a bad number rather than an outage.
Parameters
raw
unknown
The value read from the config file, of whatever type the file held.
Returns
number
An integer from -1 to 9, or the default of 7 when raw is not an integer.
toPacketCompressionThreshold()
toPacketCompressionThreshold(
raw):number
Defined in: prismarine/src/config/Config.ts:229
Bounds the configured threshold to a protocol-safe unsigned 16-bit value.
Zero disables compression, matching Bedrock's NetworkSettings semantics; positive values compress batch bodies at or above that size.
Parameters
raw
unknown
The value read from the config file, of whatever type the file held.
Returns
number
An integer from 0 to 65,535, or the default of 256 when raw is not an integer.