fix(velocity): cancel modified packets #768
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.
The velocity
PacketListenerwas not cancelling packets that were being modified by BTLP, leading to what I assume are a number of issues, but most notably players being invisible when they move into render distance.I took a look at the Bungeecord equivalent for this class, and saw some logic absent from the velocity implementation on if the the packet should be cancelled, modified, or passed. In my testing, adding this into the velocity listener fixes the issue (though this was limited to my use case, ordered dynamic tab list, backend server handling scoreboard teams). I would be interested in if @proferabg had a reason for removing it in #766, or if this was just missed in the port.
I also took the chance to clean up this code a bit, as
resultshould be reliable for determining if a modified packet should be sent, cancelled, or passed.Also updating
minecraft-data-apito include CodeCrafter47/minecraft-data-api#10, let me know if you want this is a separate PR.