MineDown-adventure
repository·main·Indexed 43 days ago
https://github.com/phoenix616/minedownA library for Minecraft developers that enables Markdown-style markup for creating complex chat components using the Kyori Adventure API (version 4.25 or newer). It supports inline formatting, RGB hex colors, gradients, click and hover events, and the rendering of player heads and item sprites.
What's inside MineDown
- MineDown-adventure is a library that allows you to use Markdown-inspired markup to create Minecraft chat components. It provides a custom syntax that offers the power of modern component messages with the simplicity of legacy formatting codes. Additionally, it supports replacing placeholders in both string-based and component-based messages.
Relocate MineDown using Maven Shade Plugin
mainTo prevent classpath conflicts with other plugins, relocate the
de.themoep.minedownpackage to a unique path within your plugin's package using themaven-shade-plugin.<build> <plugins> <plugin> <artifactId>maven-shade-plugin</artifactId> <version>3.1.0</version> <configuration> <relocations> <relocation> <pattern>de.themoep.minedown</pattern> <shadedPattern>your.package.path.libraries.minedown</shadedPattern> </relocation> </relocations> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> </plugin> </plugins> </build>Requirements for MineDown-adventure
mainTo use MineDown-adventure, you must have the kyori-adventure chat API installed.
Version Requirement:
- kyori-adventure 4.25 or newer
Platform Setup: If you are not running on a platform that supports Adventure natively (such as Paper or Velocity), you must provide one of the adventure-platform libraries in your project to handle the messages.
Include MineDown-adventure via Maven
mainTo use the Adventure implementation of MineDown, add the Minebench repository and the
minedown-adventuredependency to yourpom.xml.Note: It is highly recommended to relocate the library into your plugin's package using the
maven-shade-pluginto avoid dependency conflicts.<repositories> <repository> <id>minebench-repo</id> <url>https://repo.minebench.de/</url> </repository> </repositories> <dependencies> <dependency> <groupId>de.themoep</groupId> <artifactId>minedown-adventure</artifactId> <version>1.7.6-SNAPSHOT</version> <scope>compile</scope> </dependency> </dependencies>Use MineDown in your plugin
mainThe primary way to interact with MineDown is through the
MineDownclass. You can either instantiate a newMineDownobject to allow for manual replacements or use the staticparsemethod for a more direct approach. Both methods allow you to convert MineDown-formatted strings into AdventureComponentobjects suitable for Paper or Velocity plugins.// Using an instance with replacements player.sendMessage(new MineDown(minedownString).replace(replacements).toComponent()); // Using the static parse method player.sendMessage(MineDown.parse(minedownString, replacements));Use advanced event syntax for complex interactions
mainFor more granular control, use the
[Text](action=value)syntax. This allows you to specify specificClickEvent.ActionandHoverEvent.Actionbehaviors.Note: You can chain multiple advanced settings within a single event definition, but you cannot add multiple different colors or multiple click/hover actions to the same component.
# Link & Color [Text](open_url=https://example.com) [Text](color=red) [Text](color=#ff00ff) [Text](color=#fff-#000) # Gradient # Formatting & Style [Text](format=underline,bold) [Text](format=!underline) # Disable specific formatting [Text](shadow=#ff00ff) [Text](font=custom_font) # Commands & Clipboard [Text](run_command=/command string) [Text](suggest_command=/command) [Text](copy_to_clipboard=Text to be copied) # Special Components [](player_head=name) # Player head [](sprite=item/diamond) # Item/Block sprite [Text](translate=translation.key with={value1}) # Hover Events [Text](hover=Hover Text) [Text](show_text=Hover Text) [Text](show_entity=uuid:pig Name) [Text](show_item=stone*2 nbt...)Include legacy BungeeCord-chat library
mainIf you specifically require the legacy BungeeCord-chat version (available on the
legacybranch) instead of the Adventure implementation, use the following dependency configuration:<dependency> <groupId>de.themoep</groupId> <artifactId>minedown</artifactId> <version>1.7.1-SNAPSHOT</version> <scope>compile</scope> </dependency>Use inline formatting syntax
mainMineDown-adventure supports several inline formatting styles for Minecraft text, including legacy color codes, RGB hex colors, gradients, and standard Markdown-like styling for bold, italic, underline, strikethrough, and obfuscation.
Color legacy: ` &6Text ` Color: ` &gold&Text ` RGB Hex Color: ` &#ff00ff&Text ` RGB Hex Color (Short): ` &#f0f&Text ` Gradient: ` &#f0f-#fff&Text ` Rainbow: ` &rainbow&Text ` Rainbow Phase: ` &rainbow:20&Text ` Bold: ` **Text** ` Italic: ` ##Text## ` Underlined: ` __Text__ ` Strikethrough: ` ~~Text~~ ` Obfuscated: ` ??Text?? `Display player heads and item sprites
mainYou can render visual components like player heads or item/block sprites using an empty text bracket
[]followed by the specific action in the parentheses.Player Heads:
- By name:
[](player_head=name) - By UUID:
[](player_head=83688181-ce68-4136-918b-15e88ec2c705) - Without hat layer:
[](player_head=name hat=false) - Custom texture:
[](player_head=name texture=minecraft:entity/player/wide/alex) - Base64 profile:
[](player_head=name profile={textures=base64encodedstring})
Sprites:
- Item/Block:
[](sprite=item/diamond) - Specific Atlas:
[](sprite=item/diamond atlas=blocks)
[](player_head=name) [](sprite=item/diamond)- By name:
Use simple event syntax for links and hover text
mainYou can define click and hover events using a simplified Markdown link syntax:
[Text](content). Thecontentpart can include colors, formatting, links, or hover text.Common patterns:
- Simple Link:
[Text](https://example.com) - Simple Command:
[Text](/command to run) - Link + Hover:
[Text](https://example.com Hover Text) - Text formatting:
[Text](blue underline !bold) - Gradient:
[Text](#fff-#000) - Rainbow:
[Text](rainbow) - Phased Rainbow:
[Text](rainbow:20) - Combined:
[Text](#0000ff underline https://example.com Hover Text)
[Text](blue underline !bold) [Text](#0000ff underline https://example.com Hover Text)- Simple Link: