Hytale Color API π¨
A lightweight and efficient library designed for Hytale mod developers to easily colorize chat messages. This API automatically parses standard Minecraft-style color codes (e.g., &a, &e, &c) into Hytale's native Message objects.
β¨ Features
- Supports all standard Minecraft color codes (
&0-&f). - Includes message reset code (
&r) support. - Fully compatible with the Hytale
MessageAPI. - Extremely simple implementation and high performance.
π Installation
Follow the steps below according to your build system to include the library in your project.
Maven
Add the repository and dependency to your pom.xml:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.BartuAbiHD</groupId>
<artifactId>hytale-color-api</artifactId>
<version>v1.0.0</version>
</dependency>
</dependencies>
Gradle (Groovy)
Add this to your build.gradle:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.BartuAbiHD:hytale-color-api:v1.0.0'
}
Gradle (Kotlin DSL)
Add this to your build.gradle.kts:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
dependencies {
implementation("com.github.BartuAbiHD:hytale-color-api:v1.0.0")
}
π Usage Example
Simply call the ChatColor.parse() method to transform strings with color codes into Hytale Message objects.
import me.bartuabihd.hytaleutils.ChatColor;
import com.hypixel.hytale.server.core.universe.PlayerRef;
public class MyMod {
public void welcomePlayer(PlayerRef player) {
// Create a colorized string using & codes
String text = "&d[Server] &aWelcome to the server, &e" + player.getName() + "!";
// Parse and send as a Hytale Message object
player.sendMessage(ChatColor.parse(text));
}
}
π€ Contributing
Contributions are welcome! Feel free to open a Pull Request or report bugs via the Issues tab.
π License
This project is licensed under the MIT License.
