mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Add 'on_prejoinplayer' callback
This commit is contained in:
parent
76036abdb0
commit
33de69a173
5 changed files with 36 additions and 0 deletions
|
@ -1970,6 +1970,19 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
return;
|
||||
}
|
||||
|
||||
{
|
||||
std::string reason;
|
||||
if(m_script->on_prejoinplayer(playername, addr_s, reason))
|
||||
{
|
||||
actionstream<<"Server: Player with the name \""<<playername<<"\" "
|
||||
<<"tried to connect from "<<addr_s<<" "
|
||||
<<"but it was disallowed for the following reason: "
|
||||
<<reason<<std::endl;
|
||||
DenyAccess(peer_id, narrow_to_wide(reason.c_str()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
infostream<<"Server: New connection: \""<<playername<<"\" from "
|
||||
<<addr_s<<" (peer_id="<<peer_id<<")"<<std::endl;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue