Created
January 10, 2023 14:13
-
-
Save RedcodesDev/4c47c96ff852018ba214517e5137bd98 to your computer and use it in GitHub Desktop.
MiniMessage Utility class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You may extend this class and use the methods to simplify the use of MiniMessage