mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Rework user limit and checks around join process
This commit is contained in:
parent
b580c66b61
commit
79e0d834fd
5 changed files with 67 additions and 84 deletions
|
@ -3356,6 +3356,15 @@ bool Server::denyIfBanned(session_t peer_id)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Server::checkUserLimit(const std::string &player_name, const std::string &addr_s)
|
||||
{
|
||||
if (!m_clients.isUserLimitReached())
|
||||
return false;
|
||||
if (player_name == g_settings->get("name")) // admin can always join
|
||||
return false;
|
||||
return !m_script->can_bypass_userlimit(player_name, addr_s);
|
||||
}
|
||||
|
||||
void Server::notifyPlayer(const char *name, const std::wstring &msg)
|
||||
{
|
||||
// m_env will be NULL if the server is initializing
|
||||
|
@ -3489,7 +3498,6 @@ void Server::hudSetHotbarSelectedImage(RemotePlayer *player, const std::string &
|
|||
|
||||
Address Server::getPeerAddress(session_t peer_id)
|
||||
{
|
||||
// Note that this is only set after Init was received in Server::handleCommand_Init
|
||||
return getClient(peer_id, CS_Invalid)->getAddress();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue