Skip to content

Latest commit

 

History

History
100 lines (79 loc) · 3.53 KB

File metadata and controls

100 lines (79 loc) · 3.53 KB

ChatColorHandler

Version Number

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.

Using ChatColorHandler

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.

Adding Hex Colors to Messages

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#translate returns a Component)
  • translateRaw - Translates a string and returns output as 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.

PaperColor.handler().translate("&#aaee99Example Message %server_name%", List.of(HexParser.INSTANCE, PlaceholderAPIParser.INSTANCE))

Moving over from Spigot-API

Sending messages with ChatColorHandler is as easy as doing:

PaperColor.handler().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:

PaperColor.handler().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/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"
}