Open zml2008 opened 9 months ago
Came up with my own before someone showed me this Draft: https://gist.github.com/Minikloon/e0ec3a6ada42c127a2d4caf7cd8f0686
I don't know if mine is just simpler or I'm naive.
The logic in this processor allows passing Component
s directly into the string, so you could do something like MM."<red>Hello \{player.displayName()}"
and it'd be formatted correctly. Yours would just toString
it.
Should this be part of adventure proper? maybe a new template processors module with a higher Java requirement?
The current use of a multi-release JAR is technically unsupported, so probably not. The JAR File Spec requires that "[the] public API exported by the classes in a multi-release JAR file must be exactly the same across versions", however that requirement is not verified due to it being "difficult and costly to perform".
Additionally, implementation of this change may become more difficult once we get the new string templates. The JDK has taken the approach of creating StringTemplate
overloads to the appropriate methods. If the Mini Message were to take the same approach (i.e. MiniMessage.deserialize(StringTemplate, TagResolver...)
), it would necessitate a Java baseline that includes the new string template API due to the same multi-release JAR issues I mentioned above (because of differing APIs).
Java 23 nuked string templates, lol.
please read the mailing list comments before making uninformed comments - the plan is to make significant changes, not remove them entirely forever
please read the mailing list comments before making uninformed comments - the plan is to make significant changes, not remove them entirely forever
As far as I understand, this is not forever, but yes, they removed it from jdk 23 because they had not enough time to implement them properly again until jdk 23 will be branched. https://www.youtube.com/watch?v=c6L4Ef9owuQ
This PR is unlikely to be merged in the near future, it's mostly here as an experiment with the new preview feature in Java 21.
Some open questions for once this becomes stable are:
I'd also like to work on a template processor for
LinearComponents
at some point. That seems like something more likely to mesh well with the linear string template format.how this currently works
We try to map template parameters to MM tags. This is currently:
preProcessParsed
of the inner contentStyleBuilderApplicable
->styling
selfClosingInserting
tag of aComponent.text()
containing the string value of the template valueNotably, most of these intentionally have no impact on following content.
The tests are a good starting point for playing with the format -- what do people think?