12#ifndef MINESERVER_CONFIG_H
13#define MINESERVER_CONFIG_H
16#include <rapidjson/document.h>
35 inline rapidjson::Document::ConstMemberIterator canSafelyRead(
const rapidjson::Document &
document);
36 inline void writeSafely(rapidjson::Document &
document, rapidjson::Value &
v);
250#define CONFIG_FIELDS UF(PORT) UF(MOTD) UF(LOGLEVEL) UF(COMPRESSION_LVL) UF(ONLINE_MODE) UF(ADDRESS) \
251 UF(BACKLOG) UF(MAX_PLAYERS) UF(ICON_FILE) UF(PREVENT_PROXY_CONNECTIONS) UF(COMPRESSION_THRESHOLD)
259#define MC_VERSION_NUMBER 47
266#define MC_VERSION_NAME "Mineserver 1.8.9"
The file containing minecraft chat message implementation.
Minecraft Chat Message implementation.
Definition chatmessage.h:28
The config class.
Definition config.h:118
Field< int > COMPRESSION_THRESHOLD
The limit size for packets before they are compressed.
Definition config.h:180
static void registerCommands()
Register config commands.
Definition config.cpp:383
Field< std::string > ADDRESS
The address to listen on.
Definition config.h:205
void loadLuaLib(lua_State *state)
Load Config fields in Lua.
Definition config.cpp:390
Field< bool > PREVENT_PROXY_CONNECTIONS
Whether to prevent proxy connections or not.
Definition config.h:197
~Config()
Destroy the Config object.
Definition config.cpp:217
Field< int > COMPRESSION_LVL
The compression level for ZLib.
Definition config.h:173
Field< int > MAX_PLAYERS
Max Players.
Definition config.h:227
Field< int > PORT
The port of the instance.
Definition config.h:164
Field< int > BACKLOG
The backlog for the server.
Definition config.h:213
Field< bool > ONLINE_MODE
The online mode flag.
Definition config.h:188
Field< ChatMessage > MOTD
The Message of the Day.
Definition config.h:220
Config()
Construct a new Config object.
Definition config.cpp:199
Field< std::string > LOGLEVEL
The Log Level.
Definition config.h:234
void load()
Loads the config from disk.
Definition config.cpp:222
void save()
Saves the config on disk.
Definition config.cpp:397
Field< PNGFile > ICON_FILE
The Icon File.
Definition config.h:241
static Config * inst()
Fetch the instance of the config.
Definition config.h:275
The Field Object for the Config.
Definition config.h:31
Field(const char *section, const char *key, T def)
Construct a new Field object.
Definition config.cpp:23
std::string section
Section of the field.
Definition config.h:43
void save(rapidjson::Document &document)
Saves value to the config.
Definition config.cpp:62
void load(const rapidjson::Document &document)
Loads the value from the config.
Definition config.cpp:55
void registerLuaProperty(lua_State *state)
Register this property in Lua.
Definition config.cpp:176
~Field()
Destroy the Field object.
void setValue(T v)
Set the Value of the field.
Definition config.h:96
std::string key
Key of the field.
Definition config.h:48
const T & getValue()
Get the Value of the field.
Definition config.h:86
Wrapper around File for PNG files.
Definition file.h:87
constexpr std::string_view type_name()
Gets the name of the type paramater.
Definition event.h:56
The file containing file (lol) loading logic.