[All Paper Versions] PaperAutoUpdate - Automatically update paper.jar when you shut down your server

Hello! This is my first plugin for paper. It’s really simple, all it does is update the jar when you close the server. It only has one command, which is /paperautoupdate update. It theoretically works on all versions of Paper and all OS’, but it’s only formally been tested on 1.15.2 and Windows. You can find all the source code and download the jar here.

This is the config file. You must replace the default values with your own before your first update, or else it will not work.

PathToStartup: The absolute path to your startup script. If you don’t have a separate startup script, leave this blank.
PathToJar: The absolute path to your paper.jar or paperclip.jar.
PathToServer: The absolute path to the folder your server is in.
RestartAfterUpdate: true if you want to restart the server after it updates, false if not. If you left PathToStartup blank, set this to jar.
If you set this as true or jar, always use the stop command and not restart.
SecondsBetweenUpdateChecks: The amount of seconds between update checks. Don’t set this too low. Anything above 20 is probably safe.

Thank you for reading, and if you have any issues, please post them on the GitHub.

1 Like

I tried testing it on Paper 297, but the command would not work and Paper doesn’t update after stopping and starting.
See https://hastebin.com/igiratigud.txt for the log. I am running Ubuntu Desktop 20.04 LTS 64bit.

Hey, I know this is a lot later than you asked the question, but I’ll take a look I guess. I haven’t tested on 1.8 so maybe I’ll have to give that a try, could be that I was depending on something from newer API versions. I likely should’ve classified it as 1.15.2+ but oh well…

Edit: swoops I misread the log lol. I thought your server version was 1.8, which was actually your java version. I’ll work on a fix now.

I fixed the issue, it was a simple on that I don’t know how I overlooked. Anyways, I’ll push a patch to the github. Thanks for reporting, and sorry for taking so long to respond! Also, please report issues on the github next time, I get a notification so I respond faster.

why not use a simple bash script before running?

        as_user "wget -q -O $MCPATH/paper.jar.update https://papermc.io/ci/job/Paper-1.15/lastSuccessfulBuild/artifact/paperclip.jar"
    if [ -r "$MCPATH/paper.jar.update" ]
            if ! `diff $MCPATH/$CB_JAR $MCPATH/paper.jar.update >/dev/null`
                    as_user "mv $MCPATH/paper.jar.update $MCPATH/$CB_JAR"
                    as_user "rm $MCPATH/paper.jar.update"
1 Like

Honestly, it’s a great option. This wasn’t really meant to be something I would release, it was just a random project. Some people asked for it so I decided to put it here. For anyone looking for a simpler solution, you may just want to use the bash script.

Yeah this can be done with a bash script, I have a really good one that I use (though I didn’t make it, my friend did). Here it is:


[[ -z "$STY" ]] && { echo "You are not in a screen"; exit 1; }

oldsum=$(md5sum paperclip.jar | awk '{print $1}')
newsum=$(curl -s 'https://papermc.io/ci/job/Paper/lastSuccessfulBuild/artifact/paperclip.jar/*fingerprint*/' | ~/go/bin/pup '.md5sum json{}' | jq '.[0].text' -r | awk '{print $2}')

if [[ "$oldsum" != "$newsum" ]]; then
  wget https://papermc.io/ci/job/Paper/lastSuccessfulBuild/artifact/paperclip.jar -O paperclip.jar

{ while pgrep java | xargs -l -i readlink -f /proc/{}/cwd | grep -m 1 hub; do sleep 1; done; screen -S hubmc -X stuff "java [email protected] -Xmx1G -jar paperclip.jar\n"; } &

Basically it first checks if you’re in a screen (it’s designed to be used with Linux’s screen utility), then checks if the fingerprint of the latest is equal to the fingerprint of the local version, if not, downloads the latest version and runs the server in the screen.

Yup, makes total sense. The plugin is kinda over engineered for this job tbh, the only advantage it has over a bash script (which can be implemented in said script with a bit of work) is updating to a specific version and scheduled checks. Most of the time those features are not worth it.