Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bruhdows/MiniText

Repository files navigation

MiniText

A MiniMessage alternative based on Kyori Adventure API

Features

  • Multiple Color Formats: Legacy codes (&c), hex colors (&#ff0000, &#f00, [#ff0000], [#f00]), named colors ([red])
  • Text Decorations: Bold, italic, underlined, strikethrough with shortcuts ([b], [i], [u], [st])
  • Special Effects: Gradients ([gradient:red:blue]) and rainbow text ([rainbow])
  • Interactive Elements: Hover events and click actions
  • Custom Processors: Extensible with custom component processors
  • Bidirectional: Convert between strings and Components
  • Configurable: Enable/disable specific formatters

Quick Start

Add Jitpack Repository

maven("https://jitpack.io")
<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>

Add MiniText to dependencies

implementation("com.github.Bruhdows:MiniText:VERSION")
<dependency>
    <groupId>com.github.Bruhdows</groupId>
    <artifactId>MiniText</artifactId>
    <version>VERSION</version>
</dependency>

Replace VERSION with the latest version from Releases.

Usage

import com.bruhdows.minitext.MiniText;

// Basic usage
MiniText miniText = MiniText.miniText();
Component component = miniText.deserialize("[red][bold]Hello World!").component();

// Legacy support
String legacy = miniText.deserialize("&cHello [blue]World!").legacyString();

Syntax Examples

[red]Red text
[bold]Bold text [i]italic
&#ff0000Hex color [#f00]short hex
[gradient:red:blue]Gradient text
[rainbow]Rainbow text
[hover:show_text:'Tooltip']Hover me
[click:open_url:'https://example.com']Click me
Line 1[n]Line 2

Configuration

// Enable specific formatters
MiniText chatSafe = MiniText.builder()
    .enableOnly(FormatterType.LEGACY, FormatterType.NAMED_COLORS, FormatterType.DECORATIONS)
    .build();
// Custom processors
MiniText withVars = MiniText.builder()
    .addCustomProcessor("var", (tag, content, context) -> {
        return switch (content) {
            case "server_name" -> "My Server";
            case "player_count" -> "123";
            default -> null;
        };
    })
    .build();

About

A powerful MiniMessage alternative with intuitive bracket syntax, built on Kyori Adventure API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages