Skip to content

Commit

Permalink
feat: add static util example for MiniMessage (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlataovce authored Jul 24, 2024
1 parent 0ed0755 commit 6a674ce
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/paper/dev/api/component-api/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ final Component component = MiniMessage.miniMessage().deserialize(
"applied to all children.\n<u><!b>This is the first child, " +
"which is rendered after the parent</!b></u><key:key.inventory></b></#438df2>"
);


// if the syntax above is too verbose for you, create a helper method!

public final class Components {
public static Component mm(String miniMessageString) { // mm, short for MiniMessage
return MiniMessage.miniMessage().deserialize(miniMessageString);
}
}

// ...

import static io.papermc.docs.util.Components.mm; // replace with your own package

final Component component = mm("<blue>Hello <red>World!");
```

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

0 comments on commit 6a674ce

Please sign in to comment.