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

Allow server pong to appear if MOTDs are too long #1445

Merged
merged 3 commits into from
Jan 11, 2021

Conversation

Camotoy
Copy link
Member

@Camotoy Camotoy commented Oct 24, 2020

If the server MOTDs are 340 characters or longer, they will not appear. If this is the case, we trim each.

If the server MOTDs are 340 characters or longer, they will not appear. If this is the case, we trim each.
@Camotoy Camotoy changed the title Prevent server pong from appearing if MOTDs are too long Allow server pong to appear if MOTDs are too long Oct 24, 2020
@Camotoy Camotoy marked this pull request as draft October 29, 2020 20:41
@Camotoy
Copy link
Member Author

Camotoy commented Oct 29, 2020

Converting to draft as 1: this isn't a critical issue, 2: we want to try to understand why this is happening to better implement a fix.

// The ping will not appear if the MOTD + sub-MOTD is of a certain length.
if (pong.getMotd().length() + pong.getSubMotd().length() > 339) {
// Split the difference
if (pong.getMotd().length() > 170) {
Copy link
Member

Choose a reason for hiding this comment

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

Could this be added as a note to the config so users know it will be trimmed to 170 characters?

Comment on lines 101 to 106
if (pong.getMotd().length() > 170) {
pong.setMotd(pong.getMotd().substring(0, 170));
}
if (pong.getSubMotd().length() > 170) {
pong.setSubMotd(pong.getSubMotd().substring(0, 170));
}
Copy link
Member

Choose a reason for hiding this comment

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

Can this be changed to allow for one being slightly longer and one being slightly shorter than 170 characters?
EG:
motd: Hello, World! (13)
submotd: Some super long second motd line, with extra text! Damn didn't realise this had to be this long to hit the character limit. This is going on for a while and my brain is running out of things to type into this. (209)
Total of 222 which is less than 339 so should not cause an issue with the packet.

Copy link
Member Author

Choose a reason for hiding this comment

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

That code won't be hit unless the total length is greater than 339 (see the if statement right above).

@Camotoy Camotoy marked this pull request as ready for review January 11, 2021 20:28
@Camotoy Camotoy merged commit 6aa74a2 into GeyserMC:master Jan 11, 2021
@Camotoy Camotoy deleted the motdlengthfix branch January 11, 2021 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants