Skip to content

MessageUtils

Fulminazzo edited this page Oct 2, 2023 · 1 revision

MessageUtils is a simple utility created to help users who are not familiar with Velocity TextComponents system.
You might have noticed that calling, for example, sendMessage(String string) on a CommandSource will throw in a Deprecation warning. This is because Velocity uses net.kyori.adventure TextComponent system. To facilitate the creation and sending of this special components, BearCommands offers the MessageUtils class with just one method:

public static TextComponent messageToComponent(String message);

This method will convert a String to a TextComponent while also coloring it (whether the colors have been specified using '&' or '§').