A library for transcoding between Minecraft and Discord.
Minecraft text is represented using Kyori's Adventure (compatible with 4.x.x).
Discord text is represented using Java Strings (not relying on any specific Discord library) and is translated using a fork of Discord's SimpleAST, here.
Text/Adventure Version | MCDiscordReserializer version | Maintained |
---|---|---|
4.x.x | 4.x.x | ✔ |
3.x.x | 3.x.x | ️ |
<dependencies>
<dependency>
<groupId>dev.vankka</groupId>
<artifactId>mcdiscordreserializer</artifactId>
<version>4.3.0</version>
</dependency>
</dependencies>
repositories {
mavenCentral()
}
dependencies {
implementation 'dev.vankka:mcdiscordreserializer:4.3.0'
}
Versions Before 4.2.0
#### Maven
```xml
<repositories>
<repository>
<id>Vankka-Nexus</id>
<url>https://nexus.vankka.dev/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>dev.vankka</groupId>
<artifactId>MCDiscordReserializer</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
```
#### Gradle
```groovy
repositories {
maven {
id 'Vankka-Nexus'
url 'https://nexus.vankka.dev/repository/maven-public/'
}
}
dependencies {
implementation 'dev.vankka:MCDiscordReserializer:3.0.1'
}
```
// For Minecraft -> Discord translating
String output = DiscordSerializer.INSTANCE.serialize(TextComponent.of("Bold").decoration(TextDecoration.BOLD, true));
// For Discord -> Minecraft translating
TextComponent output = MinecraftSerializer.INSTANCE.serialize("**Bold**");