Giter VIP home page Giter VIP logo

paperupdater's Introduction

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());
});

paperupdater's People

Contributors

volandemor1 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.