A library providing about menus & update checking for Minecraft projects
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
William 85318116d9
Add snapshot version commit hash tagging
2 years ago
.github Add publishing to maven repo, adjust workflows 2 years ago
gradle/wrapper Use builders for constructing, refactor, add new version check endpoints 2 years ago
images Initial commit 2 years ago
src Bump to 2.0.3, fix trailing commas, move credit descriptions to hover 2 years ago
.gitignore Add dependabot and funding, remove .idea 2 years ago
HEADER Remove MineDown dependency, update to 2.0 2 years ago
LICENSE Initial commit 2 years ago
README.md Add publishing to maven repo, adjust workflows 2 years ago
build.gradle Add snapshot version commit hash tagging 2 years ago
gradlew Use builders for constructing, refactor, add new version check endpoints 2 years ago
gradlew.bat Initial commit 2 years ago
jitpack.yml Initial commit 2 years ago
settings.gradle Initial commit 2 years ago

README.md

DesertWell

CI Discord JitPack

DesertWell is a simple library providing various utilities to aid Minecraft plugin development on Adventure platforms. Requires Java 11+.

Example of an about menu

Features

About menus

AboutMenu.class allows for the generation of plugin about menus, as seen above.

To create an about menu, use AboutMenu#create(title) with the resource name, then use the various builder methods to build out the menu.

Displaying an AboutMenu
public class ExamplePlugin extends JavaPlugin {
    
    // Displays the about menu to the player and logs it to console
    public void showAboutMenu(Player player) {

        final AboutMenu menu = AboutMenu.builder()
            .title(Component.text("Example"))
            .description(Component.text("An example plugin"))
            .version(plugin.getVersion())
            .credits("Author",
                    AboutMenu.Credit.of("William278").description("Click to visit website").url("https://william278.net"))
            .credits("Contributors",
                    AboutMenu.Credit.of("Contributor 1").description("Code, refactoring"))
            .credits("Translators",
                    AboutMenu.Credit.of("FreeMonoid").description("Italian (it-it)"),
                    AboutMenu.Credit.of("4drian3d").description("Coding"))
            .buttons(
                    AboutMenu.Link.of("https://william278.net/docs/velocitab").text("Docs").icon("⛏"),
                    AboutMenu.Link.of("https://discord.gg/tVYhJfyDWG").text("Discord").icon("⭐").color(TextColor.color(0x6773f5)))
            .build();


        // Display the menu to the player (Depending on your platform, you may need to get the adventure audience for the Player here instead)
        player.sendMessage(menu.toComponent());
        
        // Use #toString to get a console-friendly version of the menu
        getLogger().info(AboutMenu.toString());
    }

}

Version

Version.class provides a simple way to compare semantic plugin and Minecraft versions. VersionChecker.class provides a utility for querying resources on different marketplaces (SPIGOT, MODRINTH, POLYMART and GITHUB) for the latest version of a plugin and comparing with the current version in order to check for updates.

Checking for updates
public class ExamplePlugin extends JavaPlugin {

    // Checks for updates and logs to console
    public void checkForUpdates() {
        final UpdateChecker checker = UpdateChecker.builder()
                .currentVersion(getVersion())
                .endpoint(UpdateChecker.Endpoint.MODRINTH)
                .resource("velocitab")
                .build();
        checker.check().thenAccept(checked => {
            if (!checked.isUpToDate()) {
                getLogger().info("A new update is available: " + checked.getLatestVersion());
            }
        });
    }

}

Usage

DesertWell is available on JitPack and requires Adventure. You can browse the Javadocs here.

Adding the library to your project

First, add the JitPack repository to your build.gradle:

repositories {
    maven { url 'https://jitpack.io' }
}

Then add the dependency:

dependencies {
    implementation 'net.william278:PAPIProxyBridge:1.2'
}

Maven & others

JitPack has a handy guide for how to use the dependency with other build platforms.

License

DesertWell is licensed under Apache-2.0.