-
Notifications
You must be signed in to change notification settings - Fork 36
/
testServer
57 lines (53 loc) · 1.38 KB
/
testServer
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
#!/bin/sh
doSudo="true"
type "sudo" > /dev/null || doSudo="false"
safeSudo() {
if [ $doSudo = "true" ]; then
sudo "$@"
else
"$@"
fi
}
cd run
case $1 in
setup)
cd ..
./gradlew build
cd run
safeSudo docker compose up --no-start
mkdir -p paper/plugins
cd ..
./gradlew --daemon --build-cache :downloadTestServerDependencies
;;
reset) safeSudo sh -c "
docker compose rm -fs
rm -rf paper velocity
" ;;
start) safeSudo docker compose up -d ;;
stop) safeSudo docker compose stop ;;
logs) safeSudo docker compose logs --tail=0 --follow velocity paper redis ;;
run)
printf "\u1b[34mThe standard run will attach a console to the Paper server, however you will not be able to see what you are typing.\nThis version of the run command is known to be problematic on Windows. In such a case \`run-fallback\` can be used.\u1b[0m\n"
safeSudo sh -c "
docker compose up -d
docker compose logs --follow --tail=0 velocity paper | sed \"s/^/\r/\" &
docker attach paper &> /dev/null
docker compose stop
"
;;
run-fallback)
safeSudo sh -c "
docker compose up -d
docker compose logs --tail=0 --follow velocity paper redis
docker compose stop
"
;;
op)
printf "Enter a username to OP "
read username
safeSudo docker exec paper mc-send-to-console op + $username
;;
*)
echo "Usage: server {setup|reset|start|stop|logs|run|run-fallback|op [player]}"
;;
esac