Skip to content
mdaffa48Public

About

A modern library for my minecraft plugins

Resources

Stars

1 star

Watchers

2 watching

Forks

Repository files navigation

MDLib

A modern library for my Minecraft plugins, with modules for Spigot, Velocity and BungeeCord.

Requires Java 21 or newer.

Choose your module

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 mdlib-spigot
Velocity mdlib-velocity mdlib-velocity
BungeeCord mdlib-bungeecord mdlib-bungeecord

Every platform module already includes mdlib-common mdlib-common, so you don't need to add it yourself.

Installation

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.

Maven

<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>

Gradle

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")
}

Shading and relocation

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.

Maven (maven-shade-plugin)

<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>

Gradle (Shadow plugin)

build.gradle.kts:

tasks.shadowJar {
    relocate("com.muhammaddaffa.mdlib", "your.plugin.libs.mdlib")
}

build.gradle:

shadowJar {
    relocate 'com.muhammaddaffa.mdlib', 'your.plugin.libs.mdlib'
}

Notes

  • Replace your.plugin.libs.mdlib with a package inside your own plugin, for example com.example.myplugin.libs.mdlib.
  • If your shade setup only includes certain artifacts (for example with <artifactSet> in Maven), include both your platform module and com.muhammaddaffa:mdlib-common.
  • Your code still imports from com.muhammaddaffa.mdlib as usual, because relocation only renames the packages inside the built jar. If you're moving a Spigot plugin to mdlib-spigot, your existing imports stay the same.

About

A modern library for my minecraft plugins

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages