Package cn.lunadeer.dominion.utils
Class ColorParser
java.lang.Object
cn.lunadeer.dominion.utils.ColorParser
Utility methods for converting Dominion hex color syntax.
Hex colors use the form &#RRGGBB; the Bukkit conversion method also
emits the legacy &x&r&r&g&g&b&b representation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetBukkitType(String text) Converts a string with color codes into a Bukkit-compatible color string.static net.kyori.adventure.text.TextComponentgetComponentType(String text) Converts a string with color codes into a TextComponent.static StringgetPlainText(String text) Removes color codes from a string, returning plain text.
-
Constructor Details
-
ColorParser
public ColorParser()
-
-
Method Details
-
getComponentType
Converts a string with color codes into a TextComponent.- Parameters:
text- the string with color codes- Returns:
- the TextComponent with the parsed colors
-
getBukkitType
Converts a string with color codes into a Bukkit-compatible color string.- Parameters:
text- the string with color codes- Returns:
- the Bukkit-compatible color string
-
getPlainText
Removes color codes from a string, returning plain text.- Parameters:
text- the string with color codes- Returns:
- the plain text string
-