A modern library for my Minecraft plugins, with modules for Spigot, Velocity and BungeeCord.
Requires Java 21 or newer.
Add exactly one platform module to your plugin. Each module has its own version, so use the version shown next to the one you pick.
| Platform | Artifact | Latest version |
|---|---|---|
| Spigot | mdlib-spigot |
|
| Velocity | mdlib-velocity |
|
| BungeeCord | mdlib-bungeecord |
Every platform module already includes mdlib-common , so you don't need to add it yourself.
The examples below use mdlib-spigot. For another platform, change the artifact name. In every example, replace VERSION with the latest version of your module from the table above.
<repositories>
<repository>
<id>blocksmith-releases</id>
<url>https://repo.blocksmith.studio/releases</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.muhammaddaffa</groupId>
<artifactId>mdlib-spigot</artifactId>
<version>VERSION</version>
</dependency>
</dependencies>Works in both build.gradle.kts and build.gradle:
repositories {
maven {
url = uri("https://repo.blocksmith.studio/releases")
}
}
dependencies {
implementation("com.muhammaddaffa:mdlib-spigot:VERSION")
}MDLib is not a standalone plugin, so it has to be shaded into your plugin's jar. Relocate com.muhammaddaffa.mdlib to a package your plugin owns. This stops it from clashing with other plugins that ship a different MDLib version.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>com.muhammaddaffa.mdlib</pattern>
<shadedPattern>your.plugin.libs.mdlib</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>build.gradle.kts:
tasks.shadowJar {
relocate("com.muhammaddaffa.mdlib", "your.plugin.libs.mdlib")
}build.gradle:
shadowJar {
relocate 'com.muhammaddaffa.mdlib', 'your.plugin.libs.mdlib'
}- Replace
your.plugin.libs.mdlibwith a package inside your own plugin, for examplecom.example.myplugin.libs.mdlib. - If your shade setup only includes certain artifacts (for example with
<artifactSet>in Maven), include both your platform module andcom.muhammaddaffa:mdlib-common. - Your code still imports from
com.muhammaddaffa.mdlibas usual, because relocation only renames the packages inside the built jar. If you're moving a Spigot plugin tomdlib-spigot, your existing imports stay the same.