ChatColorHandler allows you to easily add Hex Colour and MiniMessage support to your Minecraft plugins. This Library works with PaperMC (or forks) and contains built-in MiniMessage support. Spigot is not currently supported in 7.0.0 as the library has been rewritten to improve functionality on modern platforms.
The hex color format added by ChatColorHandler is &#rrggbb which does not add gradient support.
ChatColorHandler will automatically setup upon the first use of the library.
These are the main methods that you will be wanting to use in ChatColorHandler:
translate- Translates a string to the platform's result type (for example,PaperColor#translatereturns aComponent)translateRaw- Translates a string and returns output as a stringsendMessage- Sends a message to one or more playersbroadcastMessage- Sends a message to all online playerssendActionBarMessage- Sends an action bar message to one or more players
ChatColorHandler provides built in support for:
- PlaceholderAPI - requires PlaceholderAPI plugin
- MiniPlaceholders - requires MiniPlaceholders plugin
- MiniMessage - requires server to be running PaperMC (or forks)
All support built into ChatColorHandler will automatically be applied to all parsed strings, you can also define specific parsers to be used in #translate. The order in which you enter the parsers will be the same order that they are parsed.
eg.
PaperColor.handler().translate("&#aaee99Example Message %server_name%", List.of(HexParser.INSTANCE, PlaceholderAPIParser.INSTANCE))Sending messages with ChatColorHandler is as easy as doing:
PaperColor.handler().sendMessage(player, "&cThis is an example message");With ChatColorHandler you are able to change gui titles, item names, item lore, etc. All by parsing your text through ChatColorHandler:
PaperColor.handler().translate("&#bbff33Inventory Title");You can simply add ChatColorHandler to your project by adding the below into your maven or gradle build file!
Javadocs: https://oakloaf.github.io/ChatColorHandler/org/lushplugins/chatcolorhandler/common/ColorHandler.html
Maven
Repository:
<repositories>
<repository>
<id>lushplugins.org</id>
<url>https://repo.lushplugins.org/releases/</url>
</repository>
</repositories>Artifact:
<dependencies>
<dependency>
<groupId>org.lushplugins.chatcolorhandler</groupId>
<artifactId>paper</artifactId>
<version>7.0.0</version>
</dependency>
</dependencies>Gradle
Repository:
repositories {
mavenCentral()
maven { url = "https://repo.lushplugins.org/releases/" }
}Artifact:
dependencies {
compileOnly "org.lushplugins.chatcolorhandler:paper:7.0.0"
}