Skip to content

An easy to use Color Library for Minecraft Bukkit Plugins

License

Notifications You must be signed in to change notification settings

OakLoaf/ChatColorHandler

Repository files navigation

ChatColorHandler

Version Number

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).

Using ChatColorHandler

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

Adding Hex Colors to Messages

These are the main methods that you will be wanting to use in ChatColorHandler:

  • translate - Translates a string
  • sendMessage - Sends a message to one or more players
  • broadcastMessage - Sends a message to all online players
  • sendActionBarMessage - Sends an action bar message to one or more players

Compatibility

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))

Moving over from Spigot-API

Sending messages with ChatColorHandler is as easy as doing:

ChatColorHandler.sendMessage(player, "&cThis is an example message");

Adding Hex Colors to the rest of Minecraft

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");

Add ChatColorHandler to your project:

You can simply add ChatColorHandler to your project by adding the below into your maven or gradle build file!

Version Number

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"
}

Releases

No releases published

Packages

No packages published

Languages