diff --git a/source/minimessage/dynamic-replacements.rst b/source/minimessage/dynamic-replacements.rst index 3f23592..dfa4930 100644 --- a/source/minimessage/dynamic-replacements.rst +++ b/source/minimessage/dynamic-replacements.rst @@ -134,6 +134,31 @@ This will accept a ChoiceFormat pattern. This will format your input based on the provided ChoiceFormat. In this case it will be ``I met many developers!`` +Insert a list +------------- + +To insert a list of components, you can use the list formatter. + +This tag resolver will join components together. +It will accept three arguments, all of which are optional but must be provided in order and with all preceding arguments present: + +#. The separator to use between components (defaults to no separator). +#. The separator to use between the last two components (defaults to the first argument). +#. The separator to use between the last two components if there are more than two components (defaults to the second argument). + +.. code:: java + + MiniMessage.miniMessage().deserialize("Let's play !", Formatter.joining(Component.text("rock"), Component.text("paper"), Component.text("scissors"))); + +This will format your list of components by joining them together the designated separator. In this case, it will be ``Let's play rock, paper, scissors!``. + +If you want to use a different separator between the last two components, you can add another argument for the last separator. + +.. code:: java + + MiniMessage.miniMessage().deserialize("Please meet .", Formatter.joining(Component.text("John"), Component.text("Emma"), Component.text("Alex"))); + +This will result in ``Please meet John, Emma and Alex``. Complex placeholders ^^^^^^^^^^^^^^^^^^^^