feat: introduce MiniMessageContext to distinguish MiniMessage when rendering - #1437
feat: introduce MiniMessageContext to distinguish MiniMessage when rendering#1437kashike wants to merge 1 commit into
Conversation
|
Resolves #1299 |
|
Maybe instead a VirtualComponentRenderer#translatable() returning a boolean would be better? Then other api usages could indicate if the component is translatable, with a default method always returning true, while minimessage always returning false |
|
Thing is, more than if the virtual component is translatable or not, the thing in question is if it can be rendered at all, or if its just a piece of context that shall remain untouched when inside translatable components, so that a translator (minimessage's translator in this case) can take care of it. In these cases, it does make sense that the context type is a dummy class because its explicitly being marked as cannot-and-shouldnot-render-this, the context type isnt needed. I do think a more generic name for this context type could be used but i can't come up with anything better. |
|
I still consider that forcing a specific context type for virtual components that are such data holders is wrong. Some may want this renderer to ignore the component, while a different non-adventure renderer to still render it. And also in the future if a new adventure renderer would need to handle them differently again this approach would force either both ignored or none. |
|
The naming of such a marker interface is difficult - do you have any suggestions? Keep in mind that this is, currently, only applicable when the |
|
|
|
What about just adding a method to default boolean skipRenderingWhenUsedAsTranslationArgument(final VirtualComponent component) {
return false;
} |
…lationArgument to control skipping in translatable renderers
d9844df to
f5690d3
Compare
We currently prevent rendering
VirtualComponents throughTranslatableComponentRendererwhen they are used as arguments to aTranslatableComponent. Supporting them requires extending the renderer and overridingrenderTranslatableto restore that behavior, which is not ideal.