mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
Manually configurable minimum protocol version (#14054)
Partially address #13483. Server operators can set a minimum protocol version to match the game requirements (or any other restriction they may want), and it's applied as an additional constraint on top of the baseline compatibility range, optional strict_protocol_version_checking, and any kick-on-join used by the game/mods.
This commit is contained in:
@@ -4191,3 +4191,20 @@ bool Server::migrateModStorageDatabase(const GameParams &game_params, const Sett
|
||||
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
u16 Server::getProtocolVersionMin()
|
||||
{
|
||||
u16 min_proto = g_settings->getU16("protocol_version_min");
|
||||
if (g_settings->getBool("strict_protocol_version_checking"))
|
||||
min_proto = LATEST_PROTOCOL_VERSION;
|
||||
return rangelim(min_proto,
|
||||
SERVER_PROTOCOL_VERSION_MIN,
|
||||
SERVER_PROTOCOL_VERSION_MAX);
|
||||
}
|
||||
|
||||
u16 Server::getProtocolVersionMax()
|
||||
{
|
||||
return g_settings->getBool("strict_protocol_version_checking")
|
||||
? LATEST_PROTOCOL_VERSION
|
||||
: SERVER_PROTOCOL_VERSION_MAX;
|
||||
}
|
||||
|
Reference in New Issue
Block a user