diff --git a/src/main/java/com/marcusslover/plus/lib/text/Text.java b/src/main/java/com/marcusslover/plus/lib/text/Text.java index f928ded..19e165a 100644 --- a/src/main/java/com/marcusslover/plus/lib/text/Text.java +++ b/src/main/java/com/marcusslover/plus/lib/text/Text.java @@ -10,6 +10,7 @@ import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.format.TextDecoration; +import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -47,6 +48,15 @@ private Text(@NotNull Component component) { return new Text(component); } + /** + * Deserializes text using MiniMessage formatting. + * @return MiniMessage formatted text. + */ + public static @NotNull Text mini(String text) { + MiniMessage mm = MiniMessage.miniMessage(); + return new Text(mm.deserialize(text)); + } + @Deprecated public static @NotNull List<@NotNull Text> list(@NotNull List<@NotNull Component> lore) { return lore.stream().map(Text::new).collect(Collectors.toList());