mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Implement minetest.register_can_bypass_userlimit (#6369)
* Implement minetest.register_on_userlimit_check This new callback permits to bypass the max_users parameter with new mods condition, based on player name or IP Only one mod needs to permit it. Move core part for builtin privileges checks to builtin
This commit is contained in:
parent
c05228fa6d
commit
40dd03e328
6 changed files with 28 additions and 6 deletions
|
@ -209,13 +209,10 @@ void Server::handleCommand_Init(NetworkPacket* pkt)
|
|||
<< addr_s << " (peer_id=" << pkt->getPeerId() << ")" << std::endl;
|
||||
|
||||
// Enforce user limit.
|
||||
// Don't enforce for users that have some admin right
|
||||
// Don't enforce for users that have some admin right or mod permits it.
|
||||
if (m_clients.isUserLimitReached() &&
|
||||
!checkPriv(playername, "server") &&
|
||||
!checkPriv(playername, "ban") &&
|
||||
!checkPriv(playername, "privs") &&
|
||||
!checkPriv(playername, "password") &&
|
||||
playername != g_settings->get("name")) {
|
||||
playername != g_settings->get("name") &&
|
||||
!m_script->can_bypass_userlimit(playername, addr_s)) {
|
||||
actionstream << "Server: " << playername << " tried to join from "
|
||||
<< addr_s << ", but there" << " are already max_users="
|
||||
<< g_settings->getU16("max_users") << " players." << std::endl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue