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.
Adds support for the 1.19 translatable component fallbacks.
Changes
<&translate[key=<key>;(fallback=<fallback>);(with=<text>|...)]>
syntax.fallback
does a bit more understandable.@example
's, and updated for the new syntax.ObjectTag
as a param, instead of manually doing!hasParam -> return null
.&[translate=MapTag]
, with the map being the same as&translate
's input.Additions
BukkitImplDeprecations.translateLegacySyntax
-FutureWarning
for the legacy&translate
syntax.FormattedTextHelper#parseTranslatable
- util method since there are 2 places with practically identical logic for parsing them.Notes
Gave the fallback bit of the internal format for translatable components a prefix with the legacy color char, to make sure it's properly differentiated from thewith
values - let me know if there's a better way to approach this.Is there a reason the example for the tag.escape
s all of thewith
values? seemed to work as expected without that, and I think the values' safety should be pretty much guaranteed in this case? as player names are pretty strict and the other is just another translatable - and either way they're passed throughFormattedTextHelper#escape
later..escape
's from the example forwith
, since the entire map is escaped later on, and it doesn't look like they're needed (I assume they were there for legacy list parsing reasons or something?) - all the old code did was immediately unescape them; the old.with
sub-tag should still support that for back-support.startsWith("@map")
check inFormattedTextHelper#parseTranslatable
, but don't think there's a cleaner way of doing that? maybe substring the raw object prefix and check if it starts with[
? or some core method to avoid hard-coding that sort of check in?