How to use it
The library's main API access is through the MineDown.class and its parse methods.
MineDown using Adventure (e.g. on Paper or Velocity)
- snippet.java
player.sendMessage(new MineDown(rawMessage).replace(replacements).toComponent());
or with a static approach:
- snippet.java
player.sendMessage(MineDown.parse(rawMessage, replacements));
This is possible on any platform that implements the Adventure Component API!
Take a look at the MineDown JavaDocs for more detailed info on the library and the included classes.
On Spigot using adventure-platform
- snippet.java
BukkitAudiences.create(plugin).player(player).sendMessage(new MineDown(rawMessage).replace(replacements).toComponent());
or with a static approach:
- snippet.java
BukkitAudiences.create(plugin).player(player).sendMessage(MineDown.parse(rawMessage, replacements));
Take a look at the MineDown JavaDocs for more detailed info on the library and the included classes.
Legacy BungeeCord-chat API on Spigot
- snippet.java
player.spigot().sendMessage(new MineDown(rawMessage).replace(replacements).toComponent());
or with a static approach:
- snippet.java
player.spigot().sendMessage(MineDown.parse(rawMessage, replacements));
Take a look at the MineDown Legacy JavaDocs for more detailed info on the library and the included classes.
Include it into your plugin
You can easily include this library into your plugin by using maven. Make sure to relocate it into your plugin's package!
Repository
- snippet.xml
<repositories> <repository> <id>minebench-repo</id> <url>https://repo.minebench.de/</url> </repository> </repositories>
Artifact
Adventure
For usage in any platform that is supported by kyori-adventure/has an adventure-platform adapter:
- snippet.xml
<dependencies> <dependency> <groupId>de.themoep</groupId> <artifactId>minedown-adventure</artifactId> <version>1.7.3-SNAPSHOT</version> <scope>compile</scope> </dependency> </dependencies>
Please note that on platforms that don't implement Adventure themselves (e.g. Spigot or Bungee) you need to provide an adventure platform library yourself in that case. (Both Paper and Velocity provide adventure)
Legacy
Legacy version to be used with bungeecord-chat in BungeeCord and Spigot-based servers:
- snippet.xml
<dependencies> <dependency> <groupId>de.themoep</groupId> <artifactId>minedown</artifactId> <version>1.7.1-SNAPSHOT</version> <scope>compile</scope> </dependency> </dependencies>
Relocation
- snippet.xml
<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>
Alternative to shading
Alternatively you can also directly depend on my MineDownPlugin instead of shading in this library! MineDownPlugin includes a non-relocated version of this library.