Skip to content

Instantly share code, notes, and snippets.

View cosrnic's full-sized avatar

Cosmic cosrnic

View GitHub Profile
@Minikloon
Minikloon / ComponentWrapper.java
Last active October 15, 2024 21:46
Kyori Adventure Component Word Wrapping
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.Style;
import net.kyori.adventure.text.format.TextDecoration;
import net.minestom.server.utils.StringUtils;
import java.util.*;
public class ComponentWrapper {
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
public final class MiniMessageTemplate {
private MiniMessageTemplate() {}
public static final StringTemplate.Processor<Component, RuntimeException> MM = stringTemplate -> {
String interpolated = STR.process(stringTemplate);
MiniMessage mm = MiniMessage.miniMessage();
return mm.deserialize(interpolated);