From 8fcd44d2e5b31d5dc8ce0e2faf3405a283a8499a Mon Sep 17 00:00:00 2001 From: David Pakman Date: Sun, 7 Jul 2019 12:25:04 -0400 Subject: [PATCH 1/3] Fix vanilla download URL This adjusts the minecraft server vanilla download URL to be correct. --- minecraft | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minecraft b/minecraft index 27cb68d..3b64744 100755 --- a/minecraft +++ b/minecraft @@ -424,7 +424,7 @@ to_disk() { } check_update_vanilla() { - MC_SERVER_URL=`wget -q -O - http://minecraft.net/download | grep minecraft_server.jar\ | cut -d \" -f 6` + MC_SERVER_URL=`wget -q -O - https://www.minecraft.net/en-us/download/server/ | grep server.jar | cut -d \" -f 2` echo "Checking for update for minecraft_server.jar (Vanilla)" as_user "cd $MCPATH && wget -q -O $MCPATH/minecraft_server.jar.update $MC_SERVER_URL" From 7cebc4852fb5fcee8e6bcbdd715eecb44765826d Mon Sep 17 00:00:00 2001 From: David Pakman Date: Sun, 7 Jul 2019 12:29:03 -0400 Subject: [PATCH 2/3] Add support for Paper MC Server Added support for the Paper Minecraft Server (www.papermc.io) --- config.example | 7 +++++-- minecraft | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/config.example b/config.example index 54962b8..fe054b9 100644 --- a/config.example +++ b/config.example @@ -16,8 +16,11 @@ CB_JAR="craftbukkit.jar" # Define the release of CraftBukkit to use (stable or unstable) CB_RELEASE="stable" -# Name of server.jar to use (either $MC_JAR or $CB_JAR) -SERVICE=$CB_JAR +#Name of paper jar +PAPER_JAR="paper.jar" + +# Name of server.jar to use (either $MC_JAR, $CB_JAR or $PAPER_JAR) +SERVICE=$PAPER_JAR # Name to use for the screen instance SCREEN="server_screen" diff --git a/minecraft b/minecraft index 3b64744..baba16e 100755 --- a/minecraft +++ b/minecraft @@ -480,6 +480,25 @@ check_update_craftbukkit() { fi } +check_update_paper() { + echo "Checking for update for paper.jar" + + as_user "cd $MCPATH && wget -q -O $MCPATH/paper.jar.update https://papermc.io/api/v1/paper/1.14.3/latest/download" + if [ -r "$MCPATH/paper.jar.update" ] + then + if `diff $MCPATH/$PAPER_JAR $MCPATH/paper.jar.update >/dev/null` + then + echo "You are already running the latest version of paper.jar." + return 1 + else + echo "Update of $PAPER_JAR is needed." + return 0 + fi + else + echo "Something went wrong. Couldn't download paper.jar" + fi +} + mc_update() { if is_running then @@ -512,6 +531,20 @@ mc_update() { echo "Not updating $CB_JAR. It's not necessary" as_user "rm $MCPATH/craftbukkit.jar.update" fi + + if check_update_paper + then + if [ -r "$MCPATH/paper.jar.update" ] + then + as_user "mv $MCPATH/paper.jar.update $MCPATH/$PAPER_JAR" + echo "Thats it. Update of $PAPER_JAR done." + else + echo "Something went wrong. Couldn't replace your original $PAPER_JAR with paper.jar.update" + fi + else + echo "Not updating $PAPER_JAR. It's not necessary" + as_user "rm $MCPATH/paper.jar.update" + fi fi } From 18221d42e1848771be81d644f76202a20837f4d2 Mon Sep 17 00:00:00 2001 From: David Pakman Date: Sun, 7 Jul 2019 14:14:55 -0400 Subject: [PATCH 3/3] Add files via upload --- config.dpexample | 143 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 config.dpexample diff --git a/config.dpexample b/config.dpexample new file mode 100644 index 0000000..d3d6676 --- /dev/null +++ b/config.dpexample @@ -0,0 +1,143 @@ +#!/bin/bash +# +# Settings file for minecraft-init +# ================================ +# +# Make a copy of this file named config +# and edit the variables to your needs. +# + +# Name of vanilla server jar (no need to change if you're running craftbukkit and vice versa) +MC_JAR="server.jar" + +# Name of craftbukkit jar +CB_JAR="craftbukkit.jar" + +#Name of paper jar +PAPER_JAR="paper.jar" + +# Define the release of CraftBukkit to use (stable or unstable) +CB_RELEASE="stable" + +# Name of server.jar to use (either $MC_JAR, $CB_JAR, $PAPER_JAR) +SERVICE=$PAPER_JAR + +# Name to use for the screen instance +SCREEN="minecraftserver" + +# User that should run the server +USERNAME="minecraft" + +# Path to minecraft server directory +MCPATH="/home/${USERNAME}/minecraft19" + +# Path to server log file ($MCPATH/server.log on older versions) +SERVERLOG="${MCPATH}/logs/latest.log" + +# Where the worlds are located on the disk. Can not be the same as MCPATH. +# You need to move your worlds to this directory manually, the script +# will then handle the nessessay symlinks. +WORLDSTORAGE="${MCPATH}/worlds" + +# Number of CPUs/cores to use +CPU_COUNT=6 + +OPTIONS="nogui" + +# Initial memory usage +INITMEM="8192M" + +# Maximum amount of memory to use +# Remember: give the ramdisk enough space, subtract from the total amount +# of RAM available the size of your map and the RAM-consumption of your base system. +MAXMEM="10240M" + +# Whether to output commands for the plugin ConsoleLikeChat ($1 is the command to run) +FORMAT='$1' + +# Settings for backups +# =============================== + +# Location for world backups +BACKUPPATH="/home/${USERNAME}/mcbackup/worlds" + +# Where the whole minecraft directory is copied when whole-backup is executed +# whole-backup is a complete uncompressed backup of the whole server folder. +WHOLEBACKUP="/home/${USERNAME}/mcbackup/server" + +# Format for world backup (tar or zip). +BACKUPFORMAT="tar" + +# Normally backups will be put in a subfolder to $BACKUPPATH with todays date +# and the backups themselves will have a timestamp. + +# But if BACKUPSCRIPTCOMPATIBLE is set the world backups will be put directly +# in $BACKUPPATH without timestamp to be compatible with +# [backup rotation script](https://github.com/adamfeuer/rotate-backups) +# +#BACKUPSCRIPTCOMPATIBLE=YES + +# If WORLDEDITCOMPATIBLE is set the world backups will be created compatible to WorldEdit +# in $BACKUPPATH as WORLD_NAME/DATE.(tar.bz2|zip) with the requested directory structure +# +# WORLDEDITCOMPATIBLE=YES + +# Compress the whole backup with bzip2? +# Note that this may not save a lot of disk space since there can be a lot of files +# in your server directory, that are already compressed, but it can slow down the +# backup a bit. This highly depends on the plugins you're using. +# +# For example: The png files generated by Dynmap are already compressed and still use +# a lot of space in your server directory, so the compression ratio of the compressed +# backup will not be very high. +COMPRESS_WHOLEBACKUP=YES + + +# Settings for log rolling +# =============================== + +# Location for old logs +# Used by the log-roll command +LOGPATH="/home/${USERNAME}/mcbackup/logs" + +# Whether or not to gzip logs (must be commented out for no - DO NOT CHANGE TO NO) +# +GZIPLOGS=YES + +# What to append to the logfile name (Leave blank for nothing) +LOGFILEAPPEND="logfile_" + + +# Settings for overviewer command +# =============================== + +# Where the Map is generated +OUTPUTMAP="/home/${USERNAME}/mc-overviewer/render" + +# Path to Minecraft-Overviewer +OVPATH="/home/${USERNAME}/mc-overviewer/Minecraft-Overviewer" + +# Path for the config file of Overviewer +OVCONFIGPATH="/home/${USERNAME}/mc-overviewer" + +# Name of Overviewer config file +OVCONFIGNAME="config.py" + +# Path for backup worlds +OVBACKUP="/home/${USERNAME}/mc-overviewer/overviewerbackups" + +# Things to leave alone ;) +# ===================== + +#INVOCATION="java -Xmx$MAXMEM -Xms$INITMEM -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=$CPU_COUNT -XX:+AggressiveOpts -jar $SERVICE nogui" + +INVOCATION="java -Xmx$MAXMEM -Xms$INITMEM \ +-XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=100 \ +-XX:+DisableExplicitGC -XX:TargetSurvivorRatio=90 -XX:G1NewSizePercent=50 \ +-XX:G1MaxNewSizePercent=80 -XX:G1MixedGCLiveThresholdPercent=50 -XX:+AlwaysPreTouch \ +-XX:+ParallelRefProcEnabled -Dusing.aikars.flags=mcflags.emc.gs \ +-Djline.terminal=jline.UnsupportedTerminal -jar $SERVICE $OPTIONS" + + +# Path to the the mounted ramdisk (the default will work in most senarios). +RAMDISK="/dev/shm" \ No newline at end of file