This is a simple program that will check for updates to Minecraft server jar and download them if they are available.
Download the latest version of MCServerUpdater from here
Option Description
------ -----------
--help Get the list of arguments
--projects Get the list of projects
--output <String> The output file path (default: server.jar)
--project <String> The project to download (default: paper)
--version <String> The project version (default: default)
- List all available projects
java -jar MCServerUpdater.jar --projects
- Download the latest build of Paper
java -jar MCServerUpdater.jar
java -jar MCServerUpdater.jar --project paper
- Download the latest build of Paper and save it to the file
server.jar
java -jar MCServerUpdater.jar --output server.jar
java -jar MCServerUpdater.jar --project paper --output server.jar
- Download the latest build of Paper 1.17.1
java -jar MCServerUpdater.jar --project paper --version 1.17.1
- Add this as a dependency
- Maven
<dependencies>
<dependency>
<groupId>io.github.projectunified</groupId>
<artifactId>mc-server-updater-lib</artifactId>
<version>VERSION</version>
</dependency>
</dependencies>
- Gradle
dependencies {
compileOnly(group: 'io.github.projectunified', name: 'mc-server-updater-lib', version: 'VERSION')
}
- Use the
UpdateBuilder
to create, execute the update process and get the result asUpdateStatus
import java.util.concurrent.CompletableFuture;
class Main {
public static void main(String[] args) {
UpdateBuilder builder = UpdateBuilder.updateProject("paper")
.version("1.17.1")
.outputFile("server.jar");
// Execute the update process asynchronously
CompletableFuture<UpdateStatus> future = builder.executeAsync();
// Execute the update process synchronously
UpdateStatus status = builder.execute();
}
}
- Do whatever you want with the
UpdateStatus
Name | Description | Default |
---|---|---|
MCServerUpdater.javaExecutable |
The Java executable to run external processes (Spigot Updater, etc.) | java |