log players on server

This commit is contained in:
2024-07-23 01:11:23 +02:00
parent 89d5ad5f54
commit ff73cd348e
2 changed files with 8 additions and 0 deletions

View File

@@ -1,6 +1,8 @@
#include <server/handlers/PlayerLoginHandler.h> #include <server/handlers/PlayerLoginHandler.h>
#include <Nazara/Core/Time.hpp> #include <Nazara/Core/Time.hpp>
#include <blitz/common/Format.h>
#include <blitz/common/Log.h>
#include <blitz/components/PlayerInfo.h> #include <blitz/components/PlayerInfo.h>
#include <server/components/EnetConnection.h> #include <server/components/EnetConnection.h>
#include <server/components/KeepAliveSession.h> #include <server/components/KeepAliveSession.h>
@@ -62,6 +64,8 @@ void PlayerLoginHandler::Handle(std::uint16_t a_PeerId, const protocol::data::Pl
for (auto [entity, connection] : world->GetRegistry().view<EnetConnectionComponent>().each()) { for (auto [entity, connection] : world->GetRegistry().view<EnetConnectionComponent>().each()) {
connection.m_Connection->SendPlayerJoin({newPlayer}); connection.m_Connection->SendPlayerJoin({newPlayer});
} }
LogD(Format("[Server] %s joined !", a_PlayerLogin.m_PlayerName.c_str()));
} }
} // namespace server } // namespace server

View File

@@ -5,6 +5,9 @@
#include <server/Server.h> #include <server/Server.h>
#include <blitz/common/Format.h>
#include <blitz/common/Log.h>
namespace blitz { namespace blitz {
namespace server { namespace server {
@@ -24,6 +27,7 @@ void DisconectSystem::Update(Nz::Time elapsedTime) {
for (auto [entity, connection] : registry.view<EnetConnectionComponent>().each()) { for (auto [entity, connection] : registry.view<EnetConnectionComponent>().each()) {
connection.m_Connection->SendPlayerLeave({player->m_PlayerId}); connection.m_Connection->SendPlayerLeave({player->m_PlayerId});
} }
LogD(Format("[Server] %s left !", player->m_Pseudo.c_str()));
} }
} }