Skip to content

Commit 84e56d2

Browse files
tahmid-23kezz
authored andcommitted
add list dynamic replacement
1 parent 6a70069 commit 84e56d2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

source/minimessage/dynamic-replacements.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,27 @@ This will accept a ChoiceFormat pattern.
134134
135135
This will format your input based on the provided ChoiceFormat. In this case it will be ``I met many developers!``
136136
137+
Insert a list
138+
-------------
139+
140+
To insert a list of components, you can use the list formatter.
141+
142+
This tag resolver will join components together with a separator.
143+
144+
.. code:: java
145+
146+
MiniMessage.miniMessage().deserialize("Let's play <moves:, >!", Formatter.joining(Component.text("rock"), Component.text("paper"), Component.text("scissors")));
147+
148+
This will format your list of components by joining them together with your designated separator. In this case, it will be ``Let's play rock, paper, scissors!``.
149+
150+
If you want to use a different separator between the last two components, you can add another argument for the last separator.
151+
152+
.. code:: java
153+
154+
MiniMessage.miniMessage().deserialize("Please meet <names:, : and >.", Formatter.joining(Component.text("John"), Component.text("Emma"), Component.text("Alex")));
155+
156+
This will result in ``Please meet John, Emma and Alex``.
157+
137158
138159
Complex placeholders
139160
^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)