Fixed parsing of the MOTD as Component #625
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.
When the change to handling the MOTD as Adventure components was implemented, there seemed to have been a tiny mistake on how things were being parsed.
I noticed this when I was updating one of my personal projects that uses MCProtocolLib as a dependency.
Below are some examples of how the MOTD looked before switching to Adventure and after.
Before: https://paste.gg/p/anonymous/47f169ede38d453e80ca7338acc9c4c7
After: https://paste.gg/p/anonymous/037d5fad36704d5ca67a8b59cbcdaa28
The main thing to notice here is the MOTD section. As you can see in the before, the raw and formatted are cleanly done with not much extra whitespace. After updating to a version of MCProtocolLib that used Adventure, the output looked like the after post, which instantly caught my eye that something was off. After doing some digging, it turns out the issue was that the MOTD was being converted to a string directory from the JsonElement. This caused some double parsing to go on and have some escape character problems as you also saw in the after post. This PR fixes how the MOTD is being parsed and returns it back to normal. Below, I have linked another paste which shows what my PR changes and you can see how the MOTD section looks back normal.
This PR: https://paste.gg/p/anonymous/ae1929ab813a47b4aa1ec5011ddc99b7