API for PaperMC Minecraft Server core updates. Made by The Asgard with love 💙
Requires PaperMC
<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>
repositories {
maven { url "https://asgard.fun/repository/maven-public/" }
}
dependencies {
implementation 'fun.asgard:PaperUpdater:1.4'
}
PLEASE READ OUR DOCUMENTATION ALSO! THIS GUIDE IS NOT ALL THE POSSIBILITIES OF OUR LIBRARY!
public final class Example extends JavaPlugin {
public static PaperUpdater PU;
@Override
public void onEnable() {
PU = new PaperUpdater(this);
}
}
if (PU.isAvailableUpdate()) {
// Update available
} else {
// No new update found
}
PU.getLatestBuild()
PU.getCurrentPaperJar()
PU.getCurrentPaperBuild()
// |File name|
PU.setStartingFile("start.sh")
// | 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")
PU.removeUnneededPapers()
PU.downloadLatestPaper()
// |Build id|
PU.downloadPaper(PU.getUtils().getBuildById( 154 ))
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());
});