Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added disconnect reason #114

Merged
merged 1 commit into from
Dec 2, 2023
Merged

added disconnect reason #114

merged 1 commit into from
Dec 2, 2023

Conversation

1zun4
Copy link
Contributor

@1zun4 1zun4 commented Nov 29, 2023

Hello there,

with this PR I have added the possibility to catch disconnect events and their reason easily.

But here is an issue that I am facing and cannot figure out how to fix:
When the server disconnects us from the game, we normally get ClientboundGamePacket::Disconnect but the connection is closed before we can read the packet and fire the event with an reason. This causes us to not get the actual disconnect message and I really need HELP with this issue.

@1zun4
Copy link
Contributor Author

1zun4 commented Nov 29, 2023

How it should look like (disconnect by Velocity).
image

How it fails (disconnect by plugin):
image

Seems Velocity, when disconnected by plugin, sends it as ClientboundCustomPayloadPacket, that explains why I could not capture it as ClientboundGamePacket::Disconnect.

Edit: Might handle custom payloads (as disconnect), for my use-case this CCBlueX@86db681 is enough. Also might not parse it already, as it does not always use the standarised ResourceLocation format.

@1zun4 1zun4 marked this pull request as ready for review November 30, 2023 11:40
Copy link
Collaborator

@mat-1 mat-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'm changing the reason to an Option<FormattedText> after merging this though since there's some cases where the user will want to format the text another way. Also I noticed a couple bugs with disconnecting while testing this but those are totally my fault.

@mat-1 mat-1 merged commit fbee81e into azalea-rs:main Dec 2, 2023
1 check passed
@1zun4 1zun4 deleted the disconnect_reason branch April 10, 2024 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants