move postPlayerAuth later again, after client insert

This commit is contained in:
Lion Kortlepel 2024-09-18 16:23:50 +02:00
parent 8f9db10474
commit 86b37e8ae1
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B

View File

@ -437,15 +437,10 @@ std::shared_ptr<TClient> TNetwork::Authentication(TConnection&& RawConnection) {
ClientKick(*Client, Reason);
}
auto PostFutures = LuaAPI::MP::Engine->TriggerEvent("postPlayerAuth", "", Allowed, Client->GetName(), Client->GetRoles(), Client->IsGuest(), Client->GetIdentifiers());
// the post event is not cancellable so we dont wait for it
LuaAPI::MP::Engine->ReportErrors(PostFutures);
if (!Allowed) {
return {};
}
if (mServer.ClientCount() < size_t(Application::Settings.getAsInt(Settings::Key::General_MaxPlayers))) {
} else if (mServer.ClientCount() < size_t(Application::Settings.getAsInt(Settings::Key::General_MaxPlayers))) {
beammp_info("Identification success");
mServer.InsertClient(Client);
TCPClient(Client);
@ -453,6 +448,10 @@ std::shared_ptr<TClient> TNetwork::Authentication(TConnection&& RawConnection) {
ClientKick(*Client, "Server full!");
}
auto PostFutures = LuaAPI::MP::Engine->TriggerEvent("postPlayerAuth", "", Allowed, Client->GetName(), Client->GetRoles(), Client->IsGuest(), Client->GetIdentifiers());
// the post event is not cancellable so we dont wait for it
LuaAPI::MP::Engine->ReportErrors(PostFutures);
return Client;
}