mcstatus
mcstatus copied to clipboard
Rewrite MOTD parser
Full rewrite of MOTD parser. I also made an API for users, so they can easily write their own parser.
Closes #204.
Found something strange, when I read about the protocol, found that all text in MOTD can be formatted with one tag on top level. See this. Should I implement parsing for this?
Found something strange, when I read about the protocol, found that all text in MOTD can be formatted with one tag on top level. See this. Should I implement parsing for this?
That's interesting, good catch, yeah it probably should be respected, even though I don't think I've seen that before. If you are going to be adding support for that here, make sure to also add a unit-test for that. Otherwise, you can reference this comment in a new issue about this and let someone else handle it later.
NOTE: If this PR wasn't yet supposed to be reviewed, please mark it back as draft PR and feel free to ignore this review up until you think the PR will be ready.
This is ready to review, but not for merge. I'm keep doing ansi
and xterm-256
properties.
I pretty sure, few big moments here still needs more work.
Adding do-not-merge label, as requested.
This do-not-merge is here because this PR relies on renaming description
to motd
, which is currently a change that's not final and is still being discussed. To avoid the same discussion from happening here, a do-not-merge label is added until that discussion is resolved/306 gets merged.
Note that this PR can be still reviewed and approved, it just shouldn't yet be merged. But when reviewing, this blocking status should be taken into consideration, and some points on changes in variable naming or other inconsistencies with current code-base may not actually be inconsistencies, as this assumes the pending decision about this rename in 306 will end up on choosing to rename description to motd.
- [ ] Merging blocked by #306
Hmm, I found a server that's using text
that includes the special color formatting:
However this implementation is currently treating these text blocks as just plain strings (line 265):
text = item.get("text")
if text is not None:
parsed_motd.append(text)
Perhaps it would be wise to do parsed_motd.extend(cls._parse_as_string(text, bedrock))
, so that we'll actually parse out the colors in this text too.
I do not remember what I wanted to improve here, so opening this for review.
Perhaps it would be wise to do
parsed_motd.extend(cls._parse_as_string(text, bedrock))
, so that we'll actually parse out the colors in this text too.