Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vankka/enhancedlegacytext

An alternative input format for Adventure
https://github.com/vankka/enhancedlegacytext

java minecraft

Last synced: about 2 months ago
JSON representation

An alternative input format for Adventure

Awesome Lists containing this project

README

        

# EnhancedLegacyText

[![Maven Central](https://img.shields.io/maven-central/v/dev.vankka/enhancedlegacytext?label=release)](https://central.sonatype.com/search?q=g%3Adev.vankka+a%3Aenhancedlegacytext)
[![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/dev.vankka/enhancedlegacytext?label=dev&server=https%3A%2F%2Fs01.oss.sonatype.org)](https://s01.oss.sonatype.org/#view-repositories;snapshots~browsestorage~dev/vankka)

An alternative input format for [Adventure](https://github.com/KyoriPowered/adventure),
building on top of the well known [legacy formatting codes](https://minecraft.fandom.com/wiki/Formatting_codes).

## Dependency Information
### Gradle
```groovy
repositories {
mavenCentral()
}

dependencies {
implementation 'dev.vankka:enhancedlegacytext:1.0.0'
}
```

### Maven
```xml

dev.vankka
enhancedlegacytext
1.0.0
compile

```

## Basic Usage
```java
Component component = EnhancedLegacyText.get().buildComponent("&c&lThis is red, [click:open_url:https://github.com]this is clickable, this %placeholder% got replaced")
.replace("%placeholder%", Component.text("").color(NamedTextColor.GREEN))
.build();
```

## The Format

[Version 2.0.0+ Format](https://github.com/Vankka/EnhancedLegacyText/wiki/Format)

### Color & Formatting

- [The legacy codes](https://minecraft.fandom.com/wiki/Formatting_codes)
+ Exception: Formatting codes remain enabled after color codes (Can be re-enabled via `EnhancedLegacyText.Builder#colorResets`)
- Adventure's hex format, (`` / `abc123`)

### Color Gradients

Surrounded by `{` and `}`, seperated by `,`

Examples:
- `{&a,&2,&3}`
- `{&a,aa00,&3}` (mix & match permitted)
- `{7ff55,aa00,aaaa}`

## Square Brackets format

### Click & Hover Events

Events are surrounded by `[` and `]`, and split at the first two `:`, first part being either `click` or `hover`

#### Click

Valid types: `open_url`, `run_command`, `suggest_command`, `change_page`, `copy_to_clipboard`

Examples:
- `[click:open_url:https://github.com/Vankka/EnhancedLegacyText]`
- `[click:run_command:say hello]`
- `[click:suggest_command:/help]`
- `[click:change_page:2]`
- `[click:copy_to_clipboard:Secret]`

#### Hover

Valid type: `show_text`

Examples:
- `[hover:show_text:Hello]`
- `[hover:show_text:aa00Hello]`