This is the problem I encountered when coding the server plugin.
When you are swimming, attack other creatures, your swim status on the server-side will become "false", but the client is still swimming.
I guess this is a code conflict because the "sprint" status of the player when attacking other creatures will be set to "false", which will cause the player's swimming status to be set to "false"?
Thank you for your report!
We're actually already tracking this issue in MC-129568, so I resolved and linked this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature in the future to see if the issue has already been reported.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki