Mineserver
A rewrite of Minecraft 1.8.9 in C++ !
|
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 Config * | inst () |
Fetch the instance of the config. | |
Public Attributes | |
Field< int > | PORT = Field("network", "port", 25565) |
The port of the instance. | |
Field< int > | COMPRESSION_LVL = Field("network", "compression_level", -1) |
The compression level for ZLib. | |
Field< int > | COMPRESSION_THRESHOLD = Field("network", "compression_threshold", 256) |
The limit size for packets before they are compressed. | |
Field< bool > | ONLINE_MODE = Field("network", "online_mode", true) |
The online mode flag. | |
Field< bool > | PREVENT_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< int > | BACKLOG = Field("network", "backlog", 10) |
The backlog for the server. | |
Field< ChatMessage > | MOTD = Field("display", "motd", ChatMessage("This is a minecraft server")) |
The Message of the Day. | |
Field< int > | MAX_PLAYERS = Field("server", "max_players", 100) |
Max Players. | |
Field< std::string > | LOGLEVEL = Field("other", "loglevel", std::string("ALL")) |
The Log Level. | |
Field< PNGFile > | ICON_FILE = Field("display", "icon_file", PNGFile("./icon.png")) |
The Icon File. | |
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.
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.
Fetch the instance of the config.
Gets the instance of the config, following the singleton class-like.
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.
Load Config fields in Lua.
state | the lua state |
void Config::save | ( | ) |
Saves the config on disk.
Writes the content of the fields on disk, saving all of it !
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.
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.
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.
The limit size for packets before they are compressed.
If a packet exceed the compression threshold, it will get compressed.
The Icon File.
The icon file that is sent to the server while pinging.
Max Players.
The max number of players allowed on the server.
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.
The online mode flag.
Whether to check with mojang when an account is logging in if the said account is crack or not.
The port of the instance.
The port on which the server should be listening on.
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).