forked from Phyremaster/papermc-docker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpapermc.sh
34 lines (29 loc) · 914 Bytes
/
papermc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Enter server directory
cd papermc
# Perform initial setup
urlPrefix=https://papermc.io/api/v2/projects/paper
if [ ${MC_VERSION} = latest ]
then
# Get the latest MC version
MC_VERSION=$(wget -qO - $urlPrefix | jq -r '.versions[-1]') # "-r" is needed because the output has quotes otherwise
fi
urlPrefix=${urlPrefix}/versions/${MC_VERSION}
if [ ${PAPER_BUILD} = latest ]
then
# Get the latest build
PAPER_BUILD=$(wget -qO - $urlPrefix | jq '.builds[-1]')
fi
JAR_NAME=papermc-${MC_VERSION}-${PAPER_BUILD}.jar
if [ ! -e ${JAR_NAME} ]
then
rm -f *.jar
wget ${urlPrefix}/builds/${PAPER_BUILD}/downloads/paper-${MC_VERSION}-${PAPER_BUILD}.jar -O ${JAR_NAME}
if [ ! -e eula.txt ]
then
java -jar ${JAR_NAME}
sed -i 's/false/true/g' eula.txt
fi
fi
# Start server
exec java -server -Xms${MC_RAML} -Xmx${MC_RAMH} ${JAVA_OPTS} -jar ${JAR_NAME} nogui