https://github.com/wiiiiam278/desertwell
General utility library for my Minecraft projects
https://github.com/wiiiiam278/desertwell
adventure library minecraft
Last synced: about 2 months ago
JSON representation
General utility library for my Minecraft projects
- Host: GitHub
- URL: https://github.com/wiiiiam278/desertwell
- Owner: WiIIiam278
- License: apache-2.0
- Created: 2022-08-24T12:09:40.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-03-31T20:04:59.000Z (about 2 years ago)
- Last Synced: 2025-03-18T17:14:31.887Z (over 1 year ago)
- Topics: adventure, library, minecraft
- Language: Java
- Homepage: http://william278.net/project/desertwell
- Size: 376 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
# DesertWell

[](https://discord.gg/tVYhJfyDWG)
[](https://jitpack.io/#net.william278/DesertWell)
**DesertWell** is a simple library providing various utilities to aid Minecraft plugin development on Adventure platforms. Requires Java 11+.

## 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
```java
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
```java
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](https://javadoc.jitpack.io/net/william278/DesertWell/latest/javadoc/).
Adding the library to your project
First, add the JitPack repository to your `build.gradle`:
```groovy
repositories {
maven { url 'https://repo.william278.net/snapshots/' }
}
```
Then add the dependency:
```groovy
dependencies {
implementation 'net.william278:desertwell:2.0.4-SNAPSHOT'
}
```
### Maven & others
JitPack has a [handy guide](https://jitpack.io/#net.william278/DesertWell/#How_to) for how to use the dependency with other build platforms.
## License
DesertWell is licensed under Apache-2.0.