-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStartServer.sh
executable file
·62 lines (59 loc) · 2.56 KB
/
StartServer.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
cd "$(realpath "$(dirname "$0")")" || exit
download() {
name=$1
path=$2
link=$3
if ! [ -f "$path" ]; then
echo Downloading "$name"
curl --proto "=https" --tlsv1.2 --silent --show-error --output "$path" --location "$link"
sleep 2
else
echo Skipping "$name"
fi
}
# Example usage: download "PaperMC" "paper.jar" "$(latestPaper "1.21.3")"
latestPaper() {
paperVersion=$1
paperBuild=$(curl --proto "=https" --tlsv1.2 --silent --show-error --location "https://api.papermc.io/v2/projects/paper/versions/$paperVersion/" | jq '.["builds"][-1]')
echo "https://api.papermc.io/v2/projects/paper/versions/$paperVersion/builds/$paperBuild/downloads/paper-$paperVersion-$paperBuild.jar"
}
start_server() {
clear
download "PaperMC" "paper.jar" "$(latestPaper "1.21.3")"
# ProtocolLib -> https://github.com/dmulloy2/ProtocolLib/
download "ProtocolLib" "plugins/ProtocolLib-5.3.0.jar" "https://github.com/dmulloy2/ProtocolLib/releases/download/5.3.0/ProtocolLib.jar"
# ViaVersion -> https://github.com/ViaVersion/ViaVersion/
download "ViaVersion" "plugins/ViaVersion-5.2.0.jar" "https://github.com/ViaVersion/ViaVersion/releases/download/5.2.0/ViaVersion-5.2.0.jar"
# ViaBackwards -> https://github.com/ViaVersion/ViaBackwards/
download "ViaBackwards" "plugins/ViaBackwards-5.2.0.jar" "https://github.com/ViaVersion/ViaBackwards/releases/download/5.2.0/ViaBackwards-5.2.0.jar"
# WorldEdit for Bukkit -> https://dev.bukkit.org/projects/worldedit/files/
download "WorldEdit" "plugins/WorldEdit-7.3.9.jar" "https://mediafilez.forgecdn.net/files/5935/693/worldedit-bukkit-7.3.9.jar"
java -Xmx2000M -Xms2000M \
-XX:+UseG1GC \
-XX:+ParallelRefProcEnabled \
-XX:MaxGCPauseMillis=200 \
-XX:+UnlockExperimentalVMOptions \
-XX:+DisableExplicitGC \
-XX:+AlwaysPreTouch \
-XX:G1NewSizePercent=30 \
-XX:G1MaxNewSizePercent=40 \
-XX:G1HeapRegionSize=8M \
-XX:G1ReservePercent=20 \
-XX:G1HeapWastePercent=5 \
-XX:G1MixedGCCountTarget=4 \
-XX:InitiatingHeapOccupancyPercent=15 \
-XX:G1MixedGCLiveThresholdPercent=90 \
-XX:G1RSetUpdatingPauseTimePercent=5 \
-XX:SurvivorRatio=32 \
-XX:+PerfDisableSharedMem \
-XX:MaxTenuringThreshold=1 \
-Dusing.aikars.flags=https://mcflags.emc.gs \
-Daikars.new.flags=true \
-Dlog4j2.formatMsgNoLookups=true \
-jar paper.jar nogui
echo "Press any key to continue..."
read -r line
start_server
}
start_server