Skip to content

Latest commit

 

History

History
203 lines (144 loc) · 4.25 KB

README.md

File metadata and controls

203 lines (144 loc) · 4.25 KB

PaperUpdater

API for PaperMC Minecraft Server core updates. Made by The Asgard with love 💙

version wiki javadocs docs discord

Update from 1.3.1 to 1.4

🧩 - Get started

Requires PaperMC

For Maven

<repository>
    <id>asgardfun</id>
    <url>https://asgard.fun/repository/maven-public/</url>
</repositorys>
<dependency>
    <groupId>fun.asgard</groupId>
    <artifactId>PaperUpdater</artifactId>
    <version>1.4</version>
</dependency>

For Gradle

repositories {
    maven { url "https://asgard.fun/repository/maven-public/" }
}
dependencies {
    implementation 'fun.asgard:PaperUpdater:1.4'
}

✈ - Brief Guide

PLEASE READ OUR DOCUMENTATION ALSO! THIS GUIDE IS NOT ALL THE POSSIBILITIES OF OUR LIBRARY!

Initialization

public final class Example extends JavaPlugin {
    public static PaperUpdater PU;

    @Override
    public void onEnable() {
        PU = new PaperUpdater(this);
    }
}    

Checking for an update

if (PU.isAvailableUpdate()) {
    // Update available
} else {
    // No new update found 
}

Get the latest build

PU.getLatestBuild()

Get the current JAR file

PU.getCurrentPaperJar()

Get the current build

PU.getCurrentPaperBuild()

Set the start file

//                |File name|
PU.setStartingFile("start.sh")

Set the content of the start file

//                        |           Example content          |
PU.setStartingFileContent("java -jar " + PU.getCurrentPaperJar())

Set JVM options (If you haven't specified the content of the start file, but have specified the name of the start file)

//             |Example JVM options|
PU.setJVMOptions("-Xmx4G -Xms4G")

Set the path of the Java (If you haven't specified the content of the start file, but have specified the name of the start file)

//             |     Example path of the Java   |
PU.setJavaPath("/usr/lib/jvm/jdk-16.0.2/bin/java")

Delete unnecessary JAR files in the server folder

PU.removeUnneededPapers()

Download the latest build

PU.downloadLatestPaper()

Download a specific build of PaperMC

//                                          |Build id|
PU.downloadPaper(PU.getUtils().getBuildById(    154   ))

File actions

To make it convenient to handle the moment when, for example, the installation of a file was completed or files were deleted, we did the processing of such actions using onComplete() and onError() methods. Here are some examples:

PU.downloadPaper("468578534845858356845793")
    .onComplete(complete -> {
        System.out.println("Installation of build 468578534845858356845793 is complete!");
    })
    .onError(error -> {
        System.out.println("An error has occurred: " + error.getErrorMessage())
    });
PU.removeUnneededPapers().onComplete(complete -> {
    System.out.println("Unnecessary Papers removed: " + complete.getFiles().toString());
});