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

fix(api): Flatten ScoreComponent to empty string if score value is null #954

Merged
merged 1 commit into from
Jul 27, 2023

Conversation

Konicai
Copy link
Contributor

@Konicai Konicai commented Jul 27, 2023

The ScoreComponent value is nullable. When the value is null (which it always should be for 1.16+) two problems occur:

  • FlattenerListener#component(@NotNull String text) implemented by the LegacyTextSerializer rightfully throws an NPE.
  • PlainTextSerializer serializes the ScoreComponent as a string literal null, unlike the vanilla client.

This attempts to resemble client behaviour more closely:

  • <1.16: Display the score value, otherwise empty text.
  • 1.16+: Always display empty text. This PR does not match that, as it will still display the value regardless of game version.

Closes #953

@kashike kashike self-assigned this Jul 27, 2023
@kashike kashike added this to the 4.15.0 milestone Jul 27, 2023
@kashike kashike enabled auto-merge July 27, 2023 03:43
@kashike kashike added this pull request to the merge queue Jul 27, 2023
Merged via the queue into KyoriPowered:main/4 with commit 249a333 Jul 27, 2023
2 checks passed
@Konicai Konicai deleted the fix/score-flattener branch December 29, 2023 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ComponentFlattener.basic() converts ScoreComponent with null value to null
2 participants