Bugfix Discussion: Resolve bedrock featureflags conflicts #245
Labels
bug
Something isn't working
enhancement
New feature or request
priority/high
High priority issues
protocol
Issue related to bedrock protocol
Milestone
Problem
The Bedrock Edition Protocol is constantly changing. To test new features while still allowing old features to be used, the StartGamePacket contains flags for certain features, for example ServerAuthoritiveInventories or ServerAuthoritiveBlockBreaking.
The issue is that the StartGamePacket can only be sent exactly once, in the beginning of the session lifecycle.
When a player joins a server through WDPE, the feature flags of the first server that a player joins are used. This also means that every other server that player joins has to use this feature set. The protocol doesn't allow us to communicate with either the client or the server that we want to change the feature set thats already provided.
This causes issues where having BDS and Nukkit servers in the same proxy is simply impossible, since they use different features and just transferring over works, but will break many mechanics like Block placement or chunk sending.
Proposed Solution
The proposed solution is to use the PlayerTransferPacket. This packet, when sent to the client, initiates a complete disconnect from the current server and a completely new connect to the target server that is specified.
When a player tries to transfer from one server to another, and that server has a different feature set enabled in the StartGamePacket, then we can detect that. We can then close the connection to the server again.
We then need to save in an ExpiringMap<String, String>, which is <playerXuid, targetServerName>, the server the player wanted to connect to and the player that wanted to connect.
We can then transfer the player to the proxy again (essentially letting him rejoin the server forcefully), just this time we skip all JoinHandlers and directly return the server that the player wanted to connect to. Now the player has the correct feature sets enabled and can play.
Questions to be solved
Impact
The text was updated successfully, but these errors were encountered: