Update component flattening to work properly with Adventure 4.20.0
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.
This is not a proper fix, it should be using the new canTranslate methods - needs to basically be my previous PR #12571
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
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
Superceded by #12690