EnhancedLegacyText
EnhancedLegacyText copied to clipboard
An alternative input format for Adventure
EnhancedLegacyText
An alternative input format for Adventure, building on top of the well known legacy formatting codes.
Dependency Information
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation 'dev.vankka:enhancedlegacytext:1.0.0'
}
Maven
<dependency>
<groupId>dev.vankka</groupId>
<artifactId>enhancedlegacytext</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
Basic Usage
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("<The placeholder replacement>").color(NamedTextColor.GREEN))
.build();
The Format
Color & Formatting
-
The legacy codes
- Exception: Formatting codes remain enabled after color codes (Can be re-enabled via
EnhancedLegacyText.Builder#colorResets
)
- Exception: Formatting codes remain enabled after color codes (Can be re-enabled via
- Adventure's hex format, (
&#<hex>
/&#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]