Skip to content

Instantly share code, notes, and snippets.

@RedcodesDev
Created January 10, 2023 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RedcodesDev/4c47c96ff852018ba214517e5137bd98 to your computer and use it in GitHub Desktop.
Save RedcodesDev/4c47c96ff852018ba214517e5137bd98 to your computer and use it in GitHub Desktop.
MiniMessage Utility class
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
/**
* Utility class to use MiniMessage from Kyori's Adventure API
* @author David Eliezer Kesselmann
*/
public abstract class MessageHandler {
private static MiniMessage msg = MiniMessage.miniMessage();
public static Component mm(String content) {
return msg.deserialize(content);
}
public static Component mm(int content) {
return msg.deserialize(String.valueOf(content));
}
public static String serialize(Component component) {
return PlainTextComponentSerializer.plainText().serialize(component);
}
}
@RedcodesDev
Copy link
Author

You may extend this class and use the methods to simplify the use of MiniMessage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment