Skip to content

ChatUtil

Larrox edited this page Aug 29, 2025 · 1 revision

The ChatUtil class in LarroxUtilsAPI is a comprehensive utility for sending colored and formatted messages to players or the console.
It supports standard chat messages, titles, subtitles, action bars, and even hex color codes.


Note

Don’t forget to import:

import dev.larrox.ChatUtil;

🚀 Features

  • Convert & color codes to Bukkit colors.
  • Send messages to players or CommandSender (console + players).
  • Send titles and subtitles with fade-in/out timings.
  • Send messages to the Action Bar (above the hotbar).
  • Process hex color codes for modern Minecraft versions.

🛠️ Examples

Send a colored chat message

ChatUtil.send(player, "&aHello, &bPlayer!");
ChatUtil.send(sender, "&cYou don’t have permission!");

Send a title and subtitle

ChatUtil.sendTitle(player, "&6Welcome!", "&7Enjoy your stay!", 10, 70, 20);

Send only a title

ChatUtil.sendTitle(player, "&cDanger!", 10, 40, 10);

Send only a subtitle

ChatUtil.sendSubtitle(player, "&eYou have new messages!", 10, 50, 10);

Send a message to the Action Bar

ChatUtil.sendActionBar(player, "&bYou gained 5 XP!");

Use Hex Colors

ChatUtil chatUtil = new ChatUtil();
String message = chatUtil.hexColor("&#FF0000Red & Hex &6Gold");
player.sendMessage(message);

✅ Best Practices

  • Use ChatUtil.send() for normal chat messages.
  • Use sendTitle and sendSubtitle for important visual notifications.
  • Use sendActionBar for temporary info like cooldowns or XP gains.
  • Use hexColor() for modern RGB color support in Minecraft 1.16+.
  • Always replace & with color codes or use hexColor for advanced colors.

Clone this wiki locally