Skip to content

Commit 6a674ce

Browse files
authored
feat: add static util example for MiniMessage (#455)
1 parent 0ed0755 commit 6a674ce

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/paper/dev/api/component-api/intro.mdx

+15
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,21 @@ final Component component = MiniMessage.miniMessage().deserialize(
8686
"applied to all children.\n<u><!b>This is the first child, " +
8787
"which is rendered after the parent</!b></u><key:key.inventory></b></#438df2>"
8888
);
89+
90+
91+
// if the syntax above is too verbose for you, create a helper method!
92+
93+
public final class Components {
94+
public static Component mm(String miniMessageString) { // mm, short for MiniMessage
95+
return MiniMessage.miniMessage().deserialize(miniMessageString);
96+
}
97+
}
98+
99+
// ...
100+
101+
import static io.papermc.docs.util.Components.mm; // replace with your own package
102+
103+
final Component component = mm("<blue>Hello <red>World!");
89104
```
90105

91106
We recommend using this format for user-facing input such as commands or configuration values.

0 commit comments

Comments
 (0)