Skip to content

Vankka/MCDiscordReserializer

Repository files navigation

MCDiscordReserializer

Maven Central Sonatype Nexus (Snapshots)

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.

Dependency information

Version

Text/Adventure Version MCDiscordReserializer version Maintained
4.x.x 4.x.x
3.x.x 3.x.x

Versions 4.2.0 and up

Maven

<dependencies>
    <dependency>
        <groupId>dev.vankka</groupId>
        <artifactId>mcdiscordreserializer</artifactId>
        <version>4.3.0</version>
    </dependency>
</dependencies>

Gradle

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'
}
```

Basic usage

// 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**");