Mineserver
A rewrite of Minecraft 1.8.9 in C++ !
Loading...
Searching...
No Matches
Config Class Reference

The config class. More...

#include <config.h>

Public Member Functions

 Config ()
 Construct a new Config object.
 
 ~Config ()
 Destroy the Config object.
 
void save ()
 Saves the config on disk.
 
void load ()
 Loads the config from disk.
 
void loadLuaLib (lua_State *state)
 Load Config fields in Lua.
 

Static Public Member Functions

static void registerCommands ()
 Register config commands.
 
static Configinst ()
 Fetch the instance of the config.
 

Public Attributes

Field< intPORT = Field("network", "port", 25565)
 The port of the instance.
 
Field< intCOMPRESSION_LVL = Field("network", "compression_level", -1)
 The compression level for ZLib.
 
Field< intCOMPRESSION_THRESHOLD = Field("network", "compression_threshold", 256)
 The limit size for packets before they are compressed.
 
Field< boolONLINE_MODE = Field("network", "online_mode", true)
 The online mode flag.
 
Field< boolPREVENT_PROXY_CONNECTIONS = Field("network", "prevent_proxy_connections", true)
 Whether to prevent proxy connections or not.
 
Field< std::string > ADDRESS = Field("network", "address", std::string("127.0.0.1"))
 The address to listen on.
 
Field< intBACKLOG = Field("network", "backlog", 10)
 The backlog for the server.
 
Field< ChatMessageMOTD = Field("display", "motd", ChatMessage("This is a minecraft server"))
 The Message of the Day.
 
Field< intMAX_PLAYERS = Field("server", "max_players", 100)
 Max Players.
 
Field< std::string > LOGLEVEL = Field("other", "loglevel", std::string("ALL"))
 The Log Level.
 
Field< PNGFileICON_FILE = Field("display", "icon_file", PNGFile("./icon.png"))
 The Icon File.
 

Detailed Description

The config class.

The (uselessly big) class that take care of the loading, saving of the configuration values from the config file. The config is a singleton.

Constructor & Destructor Documentation

◆ Config()

Config::Config ( )

Construct a new Config object.

Should only be used once, in main. Creating other objects will be useless as they will not be initialized.

Member Function Documentation

◆ inst()

static Config * Config::inst ( )
inlinestatic

Fetch the instance of the config.

Gets the instance of the config, following the singleton class-like.

Returns
Config* The instance of the config

◆ load()

void Config::load ( )

Loads the config from disk.

Loads the config by reading the file on disk as a Json Object and loading them into the fields.

◆ loadLuaLib()

void Config::loadLuaLib ( lua_State * state)

Load Config fields in Lua.

Parameters
statethe lua state

◆ save()

void Config::save ( )

Saves the config on disk.

Writes the content of the fields on disk, saving all of it !

Member Data Documentation

◆ ADDRESS

Field<std::string> Config::ADDRESS = Field("network", "address", std::string("127.0.0.1"))

The address to listen on.

The address for the server to listen on, really used in advance cases if you have multiple IPs for one server.

◆ BACKLOG

Field<int> Config::BACKLOG = Field("network", "backlog", 10)

The backlog for the server.

The amount of pending connections the server will hold before accepting them. There should not be really any need to crank up that number.

◆ COMPRESSION_LVL

Field<int> Config::COMPRESSION_LVL = Field("network", "compression_level", -1)

The compression level for ZLib.

The compression level to use with ZLib when compressing packets. Use -1 for default level. 0 means no compression, 9 means full compression.

◆ COMPRESSION_THRESHOLD

Field<int> Config::COMPRESSION_THRESHOLD = Field("network", "compression_threshold", 256)

The limit size for packets before they are compressed.

If a packet exceed the compression threshold, it will get compressed.

◆ ICON_FILE

Field<PNGFile> Config::ICON_FILE = Field("display", "icon_file", PNGFile("./icon.png"))

The Icon File.

The icon file that is sent to the server while pinging.

◆ LOGLEVEL

Field<std::string> Config::LOGLEVEL = Field("other", "loglevel", std::string("ALL"))

The Log Level.

The minimum LogLevel that the logger should use.

◆ MAX_PLAYERS

Field<int> Config::MAX_PLAYERS = Field("server", "max_players", 100)

Max Players.

The max number of players allowed on the server.

◆ MOTD

Field<ChatMessage> Config::MOTD = Field("display", "motd", ChatMessage("This is a minecraft server"))

The Message of the Day.

The message of the day to be displayed on a status update.

◆ ONLINE_MODE

Field<bool> Config::ONLINE_MODE = Field("network", "online_mode", true)

The online mode flag.

Whether to check with mojang when an account is logging in if the said account is crack or not.

◆ PORT

Field<int> Config::PORT = Field("network", "port", 25565)

The port of the instance.

The port on which the server should be listening on.

◆ PREVENT_PROXY_CONNECTIONS

Field<bool> Config::PREVENT_PROXY_CONNECTIONS = Field("network", "prevent_proxy_connections", true)

Whether to prevent proxy connections or not.

Whether to check if the incoming connection is a proxy or not. Done using Mojang's server while authenticating. Will only work if we are in online mode (ONLINE_MODE).


The documentation for this class was generated from the following files: