Revert ProtocoLlib Floodgate hack #1326
Open
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.
Summary of your change
Removed the reimplemented Floodgate code from FastLogin. The bug blocking Floodgate from executing its checks has been fixed in dmulloy2/ProtocolLib@f357ac8 (will be included in ProtocolLib v5.4.1).
Unfortunately, our checks still run before Floodgate's, so I had to manually add the Floodgate prefix to usernames for our internal checks only. The corrected username is now successfully written to the packet by Floodgate, so we don't have to do that.
Related issue
GeyserMC/Floodgate#143
Other
https://github.com/games647/FastLogin/blob/be2ec1e5a8f0a4a2aace033b2ae82b4c868108fb/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java#L52
FastLogin still relies on usernames to determine if a connection is coming from Bedrock or not. Whilst this was reasonable a few years ago, when our code didn't have reflections to extract the Channel instance of a packet, it would be way safer if we passed actual FloodgatePlayer instances to JoinManagement.onLogin(). However, that refactor would require lots of testing (offline Java, floodgate linked, floodgate not linked, geyser offline, geyser premium) on all platforms (bukkit, bungee, velocity). I don't think I'll have time to do such refactoring in the near future. So it's easier to just hack the Floodgate prefix into our checks internally as a temporary solution. Getting rid of our reimplemented Floodgate code has obvious benefits: if Floodgate changes their code, we won't have to update our reimplementation.