Skip to content

server.conf

Constants #

const default_join_port = 19132

default_join_port is the port a Bedrock client tries first when it is given an address with no port of its own.

fn difficulty_from_string #

fn difficulty_from_string(s string) int

difficulty_from_string maps a human-readable difficulty name to its protocol constant. Unknown values fall back to normal.

fn difficulty_name #

fn difficulty_name(value int) string

difficulty_name returns the canonical name for a protocol difficulty constant.

fn load #

fn load() !Config

fn load_from #

fn load_from(path string) !Config

fn update_difficulty_in_file #

fn update_difficulty_in_file(path string, new_name string) !

update_difficulty_in_file rewrites the difficulty line in a vedrock.toml shaped file. Callers pass the specific Config's own config_file (not a shared default), so persisting a runtime difficulty change never touches another instance's settings file.

struct Config #

struct Config {
pub mut:
	motd     string = 'Vedrock Server'
	sub_motd string = 'A V Bedrock server'
	address  string = '0.0.0.0'
	// port is where a client joining by address reaches the server. LAN
	// discovery is not configurable: a client only ever broadcasts to 7551.
	port          int    = default_join_port
	max_players   int    = 20
	view_distance int    = 8
	gamemode      string = 'survival'
	difficulty    string = 'normal'
	// xbox_auth verifies the Xbox Live chain in the client's Login packet. It
	// says nothing about the transport: NetherNet's own identity assertion is
	// a separate binding, and the game omits it more often than not.
	xbox_auth bool = true
	// require_identity rejects a NetherNet offer that carries no identity
	// assertion. The game only sends one in some of the ways it connects, so a
	// server that turns this on refuses the rest of them.
	require_identity bool
	// encryption negotiates Bedrock protocol encryption. NetherNet already
	// encrypts every byte over DTLS and reports so, in which case the handshake
	// is skipped no matter what this says.
	encryption            bool   = true
	compression_threshold int    = 256
	generator             string = 'flat'
	language              string = 'en'
	resource_packs        bool   = true
	resource_packs_dir    string = 'resource_packs'
	force_resource_packs  bool
	allow_client_packs    bool = true
	cdn_packs             string
	default_world         string = 'world'
	load_all_worlds       bool
	debug                 bool
	// worlds_dir/crashdumps_dir/*_file are per instance.
	worlds_dir              string = 'worlds'
	players_dir             string = 'players'
	crashdumps_dir          string = 'crashdumps'
	ops_file                string = 'ops.txt'
	permissions_file        string = 'permissions.yml'
	player_permissions_file string = 'player_permissions.yml'
	whitelist_file          string = 'whitelist.txt'
	// identity_file stores the key the server presents in its NetherNet answers.
	// Keeping it means a client that remembers the server still recognises it
	// after a restart.
	identity_file string = 'identity.key'
	// config_file is set automatically by load_from to the path it was
	// loaded from, so runtime settings changes (e.g. /difficulty) persist
	// back to the same per instance file this Config actually came from.
	config_file string = default_file
}

fn (Config) bind_address #

fn (c &Config) bind_address() string