Skip to content

klaidi4dev/ColorizeAPI

Repository files navigation

🎨 ColorizeAPI

Java 17

A lightweight and universal text formatter for Minecraft. Seamlessly mix MiniMessage, Legacy (&), and HEX (&#RRGGBB) colors in a single string.

📝 Requirements

  • Java 17 or newer

📦 Installation

This library is hosted on JitPack.

Step 1. Add the JitPack repository

Maven (pom.xml):

<repositories>
    <repository>
	    <id>jitpack.io</id>
	    <url>https://jitpack.io</url>
     </repository>
</repositories>

Gradle Groovy (build.gradle):

repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
}

Gradle Kotlin (build.gradle.kts):

repositories {
    mavenCentral()
    maven { url = uri("https://jitpack.io") }
}

Step 2. Add the dependency

Maven (pom.xml):

<dependency>
    <groupId>com.github.klaidi4dev</groupId>
    <artifactId>ColorizeAPI</artifactId>
    <version>1.0</version>
</dependency>

Gradle Groovy (build.gradle):

dependencies {
    implementation 'com.github.klaidi4dev:ColorizeAPI:1.0'
}

Gradle Kotlin (build.gradle.kts):

dependencies {
    implementation("com.github.klaidi4dev:ColorizeAPI:1.0")
}

Step 3. Relocation (⚠️ Important)

To avoid ClassNotFoundException or conflicts with other plugins, you must relocate the net.kyori library to your own package.

Maven (inside maven-shade-plugin):

<relocations>
    <relocation>
        <pattern>net.kyori</pattern>
        <shadedPattern>your.package.libs.kyori</shadedPattern>
    </relocation>
</relocations>

Gradle Groovy (inside shadowJar):

// CHANGE 'your.package' TO YOUR ACTUAL PLUGIN PACKAGE
relocate 'net.kyori', 'your.package.libs.kyori'

Gradle Kotlin (inside shadowJar):

// CHANGE 'your.package' TO YOUR ACTUAL PLUGIN PACKAGE
relocate("net.kyori', 'your.package.libs.kyori")

⚡ Usage

// 1. Parse Mixed Formats to Adventure Component (Paper)
// Input: MiniMessage + Legacy + Hex
Component component = ColorizeAPI.parseLegacy("<gradient:gold:yellow>Hello</gradient> &7World! &#ff0000(Red)");
player.sendMessage(component);

// 2. Parse Mixed Formats to Legacy String (Spigot)
String legacyText = ColorizeAPI.parseHEX("<green>Server</green> status: &#00ff00Online");
// Output: §aServer§r status: §x§0§0...Online

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages