Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Update component flattening to work properly with Adventure 4.20.0

Open metabrixkt opened this issue 6 months ago • 3 comments

Adventure v4.20.0 has introduced TranslationStore interface as a replacement for the old TranslationRegistry, so Paper's platform flattener needs to account for that as well to render translatable components properly.

TranslationRegistry now extends TranslationStore, so this change is fully backwards-compitable with plugins that still use TranslationRegistry.

metabrixkt avatar Jun 06 '25 17:06 metabrixkt

This is not a proper fix, it should be using the new canTranslate methods - needs to basically be my previous PR #12571

kezz avatar Jun 06 '25 19:06 kezz

This is not a proper fix, it should be using the new canTranslate methods - needs to basically be my previous PR #12571

No idea why, but your PR #12571 was reverted: https://github.com/PaperMC/Paper/commit/b70bca6b698cfc172891d7bfa149649160d08ba2

edit: nevermind, I see why, it was a misplaced return, will commit the fix in a minute

metabrixkt avatar Jun 06 '25 19:06 metabrixkt

Also, I did see kenny's comment on why #12586 was closed, I don't think you should delay fixing this to an undefined point in the future, as plugins that target Adventure 4.20+ (i.e. use TranslationStore instead of the old deprected TranslationRegistry) now have broken plain text serializer,.

i.e. this test would fail when it shouldn't:

String actualPlainText = PlainTextComponentSerializer.plainText().serialize(
    Component.translatable(
        "some.translation.key.registered.with.new.translation-store.class", // This is {0} translation: {1}
        Component.text("potato"),
        Component.text("throw some translatable component args at it")
    )
);

assertEquals("This is a potato translation: throw some translatable component args at it", actualPlainText); // fails

metabrixkt avatar Jun 06 '25 20:06 metabrixkt

Superceded by #12690

metabrixkt avatar Jun 26 '25 15:06 metabrixkt