-
Notifications
You must be signed in to change notification settings - Fork 5
/
install.sh
481 lines (392 loc) · 19.1 KB
/
install.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
#!/bin/bash
display() {
echo -e "\033c"
echo "
==========================================================================
$(tput setaf 6) ## ## ## #### ## ## #### ###### ###### #### ####
$(tput setaf 6) ## ## ## ## ## ## ## ## ## ## ## ## ## ##
$(tput setaf 6) #### ## ## ## ## ## ## ## ## ## ##
$(tput setaf 6) ### ## ## ## ## ## ## ## #### ## ### ## ###
$(tput setaf 6) #### ## ## ## ## ## ## ## ## ## ## ## ##
$(tput setaf 6) ## ## ## ## ## ### ## ## ## ## ## ## ##
$(tput setaf 6) ## ## ###### #### ## #### ## ###### #### ####
$(tput setaf 6) COPYRIGHT 2023 - 2024 Klovit & https://github.com/beastgamer81
==========================================================================
"
}
forceStuffs() {
if [ "$HIBERNATE_STATUS" == "true" ]; then
mkdir -p plugins
curl -s -o plugins/hibernate.jar https://raw.githubusercontent.com/beastgamer81/klovitegg/main/HibernateX-2.0.3.jar
fi
echo "eula=true" > eula.txt
}
# Install functions
installsdkman() {
if [ ! "$(command -v sdk version)" ]; then
curl -s "https://get.sdkman.io" | bash
source ".sdkman/bin/sdkman-init.sh"
fi
}
installPhp() {
REQUIRED_PHP_VERSION=$(curl -sSL https://update.pmmp.io/api?channel="$1" | jq -r '.php_version')
PMMP_VERSION="$2"
curl --location --progress-bar https://github.com/pmmp/PHP-Binaries/releases/download/php-"$REQUIRED_PHP_VERSION"-latest/PHP-Linux-x86_64-"$PMMP_VERSION".tar.gz | tar -xzv
EXTENSION_DIR=$(find "bin" -name '*debug-zts*')
grep -q '^extension_dir' bin/php7/bin/php.ini && sed -i'bak' "s{^extension_dir=.*{extension_dir=\"$EXTENSION_DIR\"{" bin/php7/bin/php.ini || echo "extension_dir=\"$EXTENSION_DIR\"" >>bin/php7/bin/php.ini
}
# Useful functions
getJavaVersion() {
java_version_output=$(java -version 2>&1)
if [[ $java_version_output == *"1.8"* ]]; then
echo "8"
elif [[ $java_version_output == *"11"* ]]; then
echo "11"
elif [[ $java_version_output == *"16"* ]]; then
echo "16"
elif [[ $java_version_output == *"17"* ]]; then
echo "17"
elif [[ $java_version_output == *"18"* ]]; then
echo "18"
else
echo "error"
fi
}
# Validation functions
JAVA_VERSION=$(getJavaVersion)
installsdkman
VER_EXISTS=$(curl -s https://api.papermc.io/v2/projects/paper | jq -r --arg VERSION $MINECRAFT_VERSION '.versions[] | contains($VERSION)' | grep -m1 true)
LATEST_VERSION=$(curl -s https://api.papermc.io/v2/projects/paper | jq -r '.versions' | jq -r '.[-1]')
if [ "${VER_EXISTS}" != "true" ]; then
MINECRAFT_VERSION=${LATEST_VERSION}
fi
MINECRAFT_VERSION_CODE=$(echo "$MINECRAFT_VERSION" | cut -d. -f1-2 | tr -d '.')
if [ "$MINECRAFT_VERSION_CODE" -ge "120" ]; then
sdk install java 21.0.2-tem
elif [ "$MINECRAFT_VERSION_CODE" -ge "117" ]; then
sdk install java 17.0.0-tem
elif [ "$MINECRAFT_VERSION_CODE" -ge "112" ]; then
sdk install java 11.0.22-tem
elif [ "$MINECRAFT_VERSION_CODE" -eq "18" ]; then
sdk install java 8.0.392-tem
fi
# Launch functions
launchJavaServer() {
if [ -e "bungee" ]; then
curl -o verify/server.jar https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar
ori_shasum=$(shasum verify/server.jar | grep -o '^[0-9a-f]*')
jar_shasum=$(shasum server.jar | grep -o '^[0-9a-f]*')
if [ "${ori_shasum}" == "${jar_shasum}" ]; then
java -Xms128M -Xmx${memory}M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -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 -DPaper.IgnoreJavaVersion=true -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
else
rm server.jar
curl -o server.jar "${DOWNLOAD_URL}"
java -Xms128M -Xmx${memory}M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -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 -DPaper.IgnoreJavaVersion=true -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
fi
elif [ -e "velocity" ]; then
if [[ -z ${VELOCITY_VERSION} ]] || [[ ${VELOCITY_VERSION} == "latest" ]]; then
VELOCITY_VERSION="latest"
fi
VER_EXISTS=$(curl -s https://papermc.io/api/v2/projects/velocity | jq -r --arg VERSION $VELOCITY_VERSION '.versions[] | contains($VERSION)' | grep true)
LATEST_VERSION=$(curl -s https://papermc.io/api/v2/projects/velocity | jq -r '.versions' | jq -r '.[-1]')
if [[ "${VER_EXISTS}" == "true" ]]; then
VELOCITY_VERSION=${VELOCITY_VERSION}
else
VELOCITY_VERSION=${LATEST_VERSION}
fi
JAR_NAME=velocity-${VELOCITY_VERSION}-latest.jar
DOWNLOAD_URL=https://papermc.io/api/v2/projects/velocity/versions/${VELOCITY_VERSION}/builds/${BUILD_NUMBER}/downloads/${JAR_NAME}
mkdir verify -p
curl -o verify/server.jar "${DOWNLOAD_URL}"
# Remove 200 mb to prevent server freeze
number=200
memory=$((SERVER_MEMORY - number))
ori_shasum=$(shasum verify/server.jar | grep -o '^[0-9a-f]*')
jar_shasum=$(shasum server.jar | grep -o '^[0-9a-f]*')
if [ "${ori_shasum}" == "${jar_shasum}" ]; then
java -Xms128M -Xmx${memory}M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -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 -DPaper.IgnoreJavaVersion=true -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
else
rm server.jar
curl -o server.jar "${DOWNLOAD_URL}"
java -Xms128M -Xmx${memory}M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -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 -DPaper.IgnoreJavaVersion=true -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
fi
elif [ -e "purpur" ]; then
VER_EXISTS=$(curl -s https://api.purpurmc.org/v2/purpur | jq -r --arg VERSION $MINECRAFT_VERSION '.versions[] | contains($VERSION)' | grep true)
LATEST_VERSION=$(curl -s https://api.purpurmc.org/v2/purpur | jq -r '.versions' | jq -r '.[-1]')
if [ "${VER_EXISTS}" == "true" ]; then
echo -e "Version is valid. Using version ${MINECRAFT_VERSION}"
else
echo -e "Specified version not found. Defaulting to the latest purpur version"
MINECRAFT_VERSION=${LATEST_VERSION}
fi
BUILD_NUMBER=$(curl -s https://api.purpurmc.org/v2/purpur/${MINECRAFT_VERSION} | jq -r '.builds.latest')
JAR_NAME=purpur-${MINECRAFT_VERSION}-${BUILD_NUMBER}.jar
DOWNLOAD_URL=https://api.purpurmc.org/v2/purpur/${MINECRAFT_VERSION}/${BUILD_NUMBER}/download
mkdir verify -p
curl -o verify/server.jar "${DOWNLOAD_URL}"
# Remove 200 mb to prevent server freeze
number=200
memory=$((SERVER_MEMORY - number))
ori_shasum=$(shasum verify/server.jar | grep -o '^[0-9a-f]*')
jar_shasum=$(shasum server.jar | grep -o '^[0-9a-f]*')
if [ "${ori_shasum}" == "${jar_shasum}" ]; then
java -Xms128M -Xmx${memory}M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -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 -DPaper.IgnoreJavaVersion=true -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
else
rm server.jar
curl -o server.jar "${DOWNLOAD_URL}"
java -Xms128M -Xmx${memory}M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -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 -DPaper.IgnoreJavaVersion=true -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
fi
elif [ -e "paper" ]; then
VER_EXISTS=$(curl -s https://api.papermc.io/v2/projects/paper | jq -r --arg VERSION $MINECRAFT_VERSION '.versions[] | contains($VERSION)' | grep -m1 true)
LATEST_VERSION=$(curl -s https://api.papermc.io/v2/projects/paper | jq -r '.versions' | jq -r '.[-1]')
if [ "${VER_EXISTS}" == "true" ]; then
echo -e "Version is valid. Using version ${MINECRAFT_VERSION}"
else
echo -e "Specified version not found. Defaulting to the latest paper version"
MINECRAFT_VERSION=${LATEST_VERSION}
fi
BUILD_NUMBER=$(curl -s https://api.papermc.io/v2/projects/paper/versions/${MINECRAFT_VERSION} | jq -r '.builds' | jq -r '.[-1]')
JAR_NAME=paper-${MINECRAFT_VERSION}-${BUILD_NUMBER}.jar
DOWNLOAD_URL=https://api.papermc.io/v2/projects/paper/versions/${MINECRAFT_VERSION}/builds/${BUILD_NUMBER}/downloads/${JAR_NAME}
mkdir verify -p
curl -o verify/server.jar "${DOWNLOAD_URL}"
# Remove 200 mb to prevent server freeze
number=200
memory=$((SERVER_MEMORY - number))
ori_shasum=$(shasum verify/server.jar | grep -o '^[0-9a-f]*')
jar_shasum=$(shasum server.jar | grep -o '^[0-9a-f]*')
if [ "${ori_shasum}" == "${jar_shasum}" ]; then
java -Xms128M -Xmx${memory}M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -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 -DPaper.IgnoreJavaVersion=true -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
else
rm server.jar
curl -o server.jar "${DOWNLOAD_URL}"
java -Xms128M -Xmx${memory}M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -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 -DPaper.IgnoreJavaVersion=true -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
fi
fi
}
launchPMMPServer() {
if [ ! "$(command -v ./bin/php7/bin/php)" ]; then
echo "Php not found, installing Php..."
sleep 5
PMMP_VERSION="${PMMP_VERSION^^}"
if [[ "${PMMP_VERSION}" == "PM4" ]]; then
API_CHANNEL="4"
elif [[ "${PMMP_VERSION}" == "PM5" ]]; then
API_CHANNEL="stable"
else
printf "Unsupported version: %s" "${PMMP_VERSION}"
exit 1
fi
installPhp "$API_CHANNEL" "$PMMP_VERSION"
sleep 5
fi
./bin/php7/bin/php ./PocketMine-MP.phar --no-wizard --disable-ansi
}
launchNodeServer() {
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install $NODE_VERSION
nvm use $NODE_VERSION
if [ -n "$NODE_DEFAULT_ACTION" ]; then
action="$NODE_DEFAULT_ACTION"
else
echo "
$(tput setaf 3)What to run?
1) Run main file 2) Install packages from package.json
"
read -r action
fi
case $action in
1)
node "${NODE_MAIN_FILE}"
;;
2)
npm install
;;
*)
echo "Error 404"
exit
;;
esac
}
optimizeJavaServer() {
echo "view-distance=6" >> server.properties
}
if [ ! -e "server.jar" ] && [ ! -e "nodejs" ] && [ ! -e "PocketMine-MP.phar" ]; then
display
sleep 5
echo "
$(tput setaf 3)Which platform are you gonna use?
1) Paper 2) Purpur
3) BungeeCord 4) Velocity
5) PocketmineMP 6) Node.js
"
read -r n
case $n in
1)
sleep 1
echo "$(tput setaf 3)Starting the download for PaperMC ${MINECRAFT_VERSION} please wait"
rm proxy
sleep 4
forceStuffs
VER_EXISTS=$(curl -s https://api.papermc.io/v2/projects/paper | jq -r --arg VERSION $MINECRAFT_VERSION '.versions[] | contains($VERSION)' | grep -m1 true)
LATEST_VERSION=$(curl -s https://api.papermc.io/v2/projects/paper | jq -r '.versions' | jq -r '.[-1]')
if [ "${VER_EXISTS}" == "true" ]; then
echo -e "Version is valid. Using version ${MINECRAFT_VERSION}"
else
echo -e "Specified version not found. Defaulting to the latest paper version"
MINECRAFT_VERSION=${LATEST_VERSION}
fi
BUILD_NUMBER=$(curl -s https://api.papermc.io/v2/projects/paper/versions/${MINECRAFT_VERSION} | jq -r '.builds' | jq -r '.[-1]')
JAR_NAME=paper-${MINECRAFT_VERSION}-${BUILD_NUMBER}.jar
DOWNLOAD_URL=https://api.papermc.io/v2/projects/paper/versions/${MINECRAFT_VERSION}/builds/${BUILD_NUMBER}/downloads/${JAR_NAME}
curl -o server.jar "${DOWNLOAD_URL}"
touch paper
rm bungee
rm velocity
rm purpur
display
echo -e ""
optimizeJavaServer
launchJavaServer
forceStuffs
;;
2)
sleep 1
echo "$(tput setaf 3)Starting the download for PurpurMC ${MINECRAFT_VERSION} please wait"
sleep 4
forceStuffs
VER_EXISTS=$(curl -s https://api.purpurmc.org/v2/purpur | jq -r --arg VERSION $MINECRAFT_VERSION '.versions[] | contains($VERSION)' | grep true)
LATEST_VERSION=$(curl -s https://api.purpurmc.org/v2/purpur | jq -r '.versions' | jq -r '.[-1]')
if [ "${VER_EXISTS}" == "true" ]; then
echo -e "Version is valid. Using version ${MINECRAFT_VERSION}"
else
echo -e "Specified version not found. Defaulting to the latest purpur version"
MINECRAFT_VERSION=${LATEST_VERSION}
fi
BUILD_NUMBER=$(curl -s https://api.purpurmc.org/v2/purpur/${MINECRAFT_VERSION} | jq -r '.builds.latest')
JAR_NAME=purpur-${MINECRAFT_VERSION}-${BUILD_NUMBER}.jar
DOWNLOAD_URL=https://api.purpurmc.org/v2/purpur/${MINECRAFT_VERSION}/${BUILD_NUMBER}/download
curl -o server.jar "${DOWNLOAD_URL}"
touch purpur
rm paper
rm bungee
rm velocity
display
echo -e ""
optimizeJavaServer
launchJavaServer
forceStuffs
;;
3)
sleep 1
echo "$(tput setaf 3)Starting the download for Bungeecord latest please wait"
sleep 4
curl -o server.jar https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar
touch bungee
rm paper
rm purpur
rm velocity
display
sleep 10
echo -e ""
launchJavaServer bungee
;;
4)
sleep 1
echo "$(tput setaf 3)Starting the download for Velocity please wait"
sleep 4
if [[ -z ${VELOCITY_VERSION} ]] || [[ ${VELOCITY_VERSION} == "latest" ]]; then
VELOCITY_VERSION="latest"
fi
VER_EXISTS=$(curl -s https://papermc.io/api/v2/projects/velocity | jq -r --arg VERSION $VELOCITY_VERSION '.versions[] | contains($VERSION)' | grep true)
LATEST_VERSION=$(curl -s https://papermc.io/api/v2/projects/velocity | jq -r '.versions' | jq -r '.[-1]')
if [[ "${VER_EXISTS}" == "true" ]]; then
echo -e "Version is valid. Using version ${VELOCITY_VERSION}"
else
echo -e "Using the latest velocity version"
VELOCITY_VERSION=${LATEST_VERSION}
fi
JAR_NAME=velocity-${VELOCITY_VERSION}-latest.jar
DOWNLOAD_URL=https://papermc.io/api/v2/projects/velocity/versions/${VELOCITY_VERSION}/builds/${BUILD_NUMBER}/downloads/${JAR_NAME}
curl -o server.jar ${DOWNLOAD_URL}
if [[ -f velocity.toml ]]; then
echo -e "velocity config file exists"
else
echo -e "downloading velocity config file."
curl https://raw.githubusercontent.com/parkervcp/eggs/master/game_eggs/minecraft/proxy/java/velocity/velocity.toml -o velocity.toml
fi
if [[ -f forwarding.secret ]]; then
echo -e "velocity forwarding secret file already exists"
else
echo -e "creating forwarding secret file"
touch forwarding.secret
date +%s | sha256sum | base64 | head -c 12 > forwarding.secret
fi
touch velocity
rm paper
rm purpur
rm bungee
display
sleep 10
echo -e ""
launchJavaServer velocity
;;
5)
sleep 1
echo "$(tput setaf 3)Starting the download for PocketMine-MP ${PMMP_VERSION} please wait"
sleep 4
PMMP_VERSION="${PMMP_VERSION^^}"
if [[ "${PMMP_VERSION}" == "PM4" ]]; then
API_CHANNEL="4"
elif [[ "${PMMP_VERSION}" == "PM5" ]]; then
API_CHANNEL="stable"
else
printf "Unsupported version: %s" "${PMMP_VERSION}"
exit 1
fi
if [ ! "$(command -v ./bin/php7/bin/php)" ]; then
installPhp "$API_CHANNEL" "$PMMP_VERSION"
sleep 5
fi
DOWNLOAD_LINK=$(curl -sSL https://update.pmmp.io/api?channel="$API_CHANNEL" | jq -r '.download_url')
curl --location --progress-bar "${DOWNLOAD_LINK}" --output PocketMine-MP.phar
display
echo -e ""
launchPMMPServer
;;
6)
echo "$(tput setaf 3)Starting Download please wait"
touch nodejs
display
sleep 10
echo -e ""
launchNodeServer
;;
*)
echo "Error 404"
exit
;;
esac
else
if [ -e "server.jar" ]; then
display
forceStuffs
if [ -e "bungee" ]; then
launchJavaServer bungee
elif [ -e "velocity" ]; then
launchJavaServer velocity
elif [ -e "paper" ]; then
launchJavaServer paper
elif [ -e "purpur" ]; then
launchJavaServer purpur
fi
elif [ -e "PocketMine-MP.phar" ]; then
display
launchPMMPServer
elif [ -e "nodejs" ]; then
display
launchNodeServer
fi
fi