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 b8c994d52f
Make toComponent public
2 years ago
.github Remove MineDown dependency, update to 2.0 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 Make toComponent public 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 Use builders for constructing, refactor, add new version check endpoints 2 years ago
build.gradle Bump dependencies 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

Discord

DesertWell is a simple library providing various utilities to aid Minecraft plugin development. 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.

Code snippet
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.create("Example")
                .withDescription("A powerful, intuitive and flexible teleportation suite")
                .withVersion(Version.fromString(plugin.getDescription().getVersion()))
                .addAttribution("Author",
                AboutMenu.Credit.of("William278").withDescription("Click to visit website").withUrl("https://william278.net"))
                .addAttribution("Contributors",
                        AboutMenu.Credit.of("Contributor 1").withDescription("Code, refactoring")
                .addAttribution("Translators",
                        AboutMenu.Credit.of("Translator 1").withDescription("Spanish (es-es)"),
                        AboutMenu.Credit.of("Translator 2").withDescription("Italian (it-it)")
                .addButtons(
                        AboutMenu.Link.of("https://william278.net/").withText("Wesbite").withIcon("⛏"),
                        AboutMenu.Link.of("https://discord.gg/tVYhJfyDWG").withText("Discord").withIcon("⭐").withColor("#6773f5"))));

        // Display the menu to the player
        player.spigot().sendMessage(menu.toMineDown().toComponents());
        
        // 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 Spigot resources for the latest version of a plugin and comparing with the current version in order to check for updates.

Code snippet
public class ExamplePlugin extends JavaPlugin {

    // Checks for updates and logs to console
    public void checkForUpdates() {
        final int spigotResourceId = 97144;
        final UpdateChecker updateChecker = UpdateChecker.create(Version.fromString("1.0.0"), spigotResourceId);
        updateChecker.isUpToDate().thenAccept(upToDate -> {
            if (upToDate) {
                getLogger().info("Running the latest version (" + updateChecker.getCurrentVersion() + ").");
            } else {
                getLogger().info("An update is available! Download from: https://www.spigotmc.org/resources/" + spigotResourceId);
            }
        });
    }

}

Installation

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

Note that your plugin will also need to shade (or shade a library that includes) MineDown.

Maven

To include the library with Maven, in your pom.xml file, first add the JitPack repository:

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

Then, add the dependency in your <dependencies> section. Remember to replace Tag with the current DesertWell version.

    <dependency>
        <groupId>net.william278</groupId>
        <artifactId>DesertWell</artifactId>
        <version>Tag</version>
        <scope>compile</scope>
    </dependency>

Gradle & others

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

License

DesertWell is licensed under Apache-2.0.