ChatColorHandler allows you to easily add Hex Colour and MiniMessage support to your Minecraft plugins. This Library works with all versions of Spigot and also adds MiniMessage support for servers running Paper (or forks).
The hex color formats added by ChatColorHandler are &#rrggbb
and #rrggbb
and 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 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.
ChatColorHandler.translate("&#aaee99Example Message %server_name%", List.of(HexParser.INSTANCE, PlacecholderAPIParser.INSTANCE))
Sending messages with ChatColorHandler is as easy as doing:
ChatColorHandler.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:
ChatColorHandler.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/ChatColorHandler.html
Maven
Repository:
<repositories>
<repository>
<id>lushplugins.org</id>
<url>https://repo.lushplugins.org/releases/</url>
</repository>
</repositories>
Artifact:
<dependencies>
<dependency>
<groupId>org.lushplugins</groupId>
<artifactId>ChatColorHandler</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>
Gradle
Repository:
repositories {
mavenCentral()
maven { url = "https://repo.lushplugins.org/releases/" }
}
Artifact:
dependencies {
compileOnly "org.lushplugins:ChatColorHandler:4.0.0"
}