1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-12 16:15:20 +02:00

Avoid packets getting sent to disconnected players (#14444)

Many functions expect RemotePlayer to have a valid peer ID,
this however is not the case immediately after disconnecting
where the object is still alive and pending for removal.

ServerEnvironment::getPlayer(const char *, bool) now only
returns players that are connected unless forced to.
This commit is contained in:
SmallJoker
2024-03-10 13:24:35 +01:00
committed by GitHub
parent 02a893d613
commit 32f68f35cf
6 changed files with 24 additions and 31 deletions

View File

@@ -388,7 +388,7 @@ public:
bool static_exists, v3s16 static_block=v3s16(0,0,0));
RemotePlayer *getPlayer(const session_t peer_id);
RemotePlayer *getPlayer(const char* name);
RemotePlayer *getPlayer(const char* name, bool match_invalid_peer = false);
const std::vector<RemotePlayer *> getPlayers() const { return m_players; }
u32 getPlayerCount() const { return m_players.size(); }