fix: duplicate player creation on death screen #3325
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This commit fixes a bug where a duplicate player instance was created when a player confirmed the death screen ("ok") and was subsequently kicked for exceeding the maximum packets per second. This bug resulted in two player objects being active simultaneously, leading to unpredictable in-game behavior because the system couldn't determine which instance to interact with.
Behaviour
Actual
When a player confirms the death screen and is kicked for exceeding the max packets per second, a duplicate player instance is created. This leads to two active instances of the same player, causing erratic in-game behavior.
Expected
Upon confirming the death screen, the system should first check if a player with the same name is already online. If so, it should use the existing instance rather than creating a new one, ensuring that only one active instance per player exists.
Type of change
How Has This Been Tested
To reproduce the bug:
[2025-05-02 00:35:23.770] [thread 26856] [warning] [Connection::parseHeader] - 127.0.0.1 disconnected for exceeding packet per second limit.
it indicates that the bug has been reproduced.
With this fix applied, the character should not duplicate when following these steps.
Checklist