1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00: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:
Warr1024 2023-12-21 12:53:30 -05:00 committed by GitHub
parent 04dc4a10f0
commit 7e143cb33d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 7 deletions

View file

@ -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;
}