-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch-debug.sh
70 lines (57 loc) · 1.79 KB
/
launch-debug.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
63
64
65
66
67
68
69
70
#!/bin/bash
########################## Configurations ##########################
# Server directory name
NAME=".debug-server"
# Server type (type[vanilla, spigot, paper]-version[1.xx.x, unspecified]-build[latest, unspecified, xx])
SERVER="paper-1.18.2-301"
# Server memory (GB)
MEMORY=2
# jdwp port, Enable debug mode when 0 or higher (5005)
DEBUG_PORT=5005
# When the server shuts down, use tar to back up.
BACKUP=false
# The server will always restart.
RESTART=false
# Preinstallation plugins (url)
PLUGINS=(
'https://github.com/monun/auto-reloader/releases/latest/download/AutoReloader.jar'
)
####################################################################
# Check wget
! type -p wget >/dev/null && echo "wget not found" && exit
# Check jq
! type -p jq >/dev/null && echo "jq not found" && exit
# Check java
! type -p java >/dev/null && echo "java not found" && exit
# Create server directory and change
mkdir -p "$NAME"
cd "$NAME" || exit
# Setup server
if [[ -f ../setup.sh ]]; then
JAR=$(../setup.sh "$SERVER" | tail)
else
JAR=$(curl -s "https://raw.githubusercontent.com/monun/minecraft-server-launcher/master/setup.sh" | bash -s -- "$SERVER" | tail)
fi
# Exit if jar not found
[[ ! -f $JAR ]] && echo "Jar not found for $SERVER" && exit
# Download plugins (Only if it's not vanilla)
if [[ $SERVER != vanilla* ]]; then
mkdir -p "./plugins"
for i in "${PLUGINS[@]}"; do
wget -q -c --content-disposition -P "./plugins" -N "$i"
done
fi
# Download start script
if [[ -f ../start.sh ]]; then
cp ../start.sh .
else
wget -q -c --content-disposition -P . -N "https://raw.githubusercontent.com/monun/minecraft-server-launcher/master/start.sh" > /dev/null
fi
# Export variables for start.sh
export JAR
export MEMORY
export DEBUG_PORT
export BACKUP
export RESTART
# Run server
bash ./start.sh launch