1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add on_auth_fail callback (#7039)

Called when a client fails to supply the correct password for the account it's attempting to login as.
This commit is contained in:
red-001 2018-02-15 20:18:54 +00:00 committed by SmallJoker
parent 861cfd8484
commit 338d645fcf
5 changed files with 20 additions and 1 deletions

View file

@ -206,3 +206,14 @@ void ScriptApiPlayer::on_playerReceiveFields(ServerActiveObject *player,
runCallbacks(3, RUN_CALLBACKS_MODE_OR_SC);
}
void ScriptApiPlayer::on_auth_failure(const std::string &name, const std::string &ip)
{
SCRIPTAPI_PRECHECKHEADER
// Get core.registered_on_auth_failure
lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_auth_fail");
lua_pushstring(L, name.c_str());
lua_pushstring(L, ip.c_str());
runCallbacks(2, RUN_CALLBACKS_MODE_FIRST);
}

View file

@ -45,4 +45,5 @@ public:
s16 on_player_hpchange(ServerActiveObject *player, s16 hp_change);
void on_playerReceiveFields(ServerActiveObject *player,
const std::string &formname, const StringMap &fields);
void on_auth_failure(const std::string &name, const std::string &ip);
};