Add some default options

Added some default options, added variables for those options.
This commit is contained in:
Jiří Štefka 2023-02-23 01:44:39 +01:00 committed by GitHub
parent d0b837e404
commit cc0801f609
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,22 +6,37 @@ version="1.19.3"
# Leave blank to use the latest build # Leave blank to use the latest build
select_build="" select_build=""
# Memory settings
initMem="1500M"
maxMem="8000M" # Maximum memory the server can use
# Options for the server # Options for the server
mc_launchoptions="-nogui" mc_launchoptions="-nogui"
# Options for the java runtime
java_launchoptions="-Xms$initMem -Xmx$maxMem" # Memory settings
initMem="2000M" # Minimum memory used
maxMem="2000M" # Maximum memory allowed to be used
# G1 settings
g1HeapMem="32M" # Memory used by G1
g1NewSize="20" # In %
g1Reserve"20" # In %
umaxGCpause="50" # In millis
# Aditional options for the java runtime
java_launchoptions=""
# Change the defaults if you use older version of minecraft or just want to use something else
java_launchoptions="-Xms$initMem -Xmx$maxMem -XX:G1HeapRegionSize=$g1HeapMem -XX:+UseG1GC -XX:G1NewSizePercent=$g1NewSize -XX:G1ReservePercent=$g1Reserve -XX:MaxGCPauseMillis=$maxGCpause $java_launchoptions"
# You shouldn't need to change anything below this line
# -----------------------------------------------------
# Api url # Api url
url="https://api.papermc.io/v2/projects/paper/versions/$version/builds" url="https://api.papermc.io/v2/projects/paper/versions/$version/builds"
# Check if selected version exists
if curl -s "$url" | grep -q '{"error":"Version not found."}'; then if curl -s "$url" | grep -q '{"error":"Version not found."}'; then
echo "Error: Invalid version selected: $version" echo "Error: Invalid version selected: $version"
exit 1 exit 1
else else
# Check if selected build exists
if [ ! -z "$select_build" ]; then if [ ! -z "$select_build" ]; then
if curl -Is "https://api.papermc.io/v2/projects/paper/versions/$version/builds/$select_build/downloads/paper-$version-$select_build.jar" | grep "HTTP/2 404" >/dev/null; then if curl -Is "https://api.papermc.io/v2/projects/paper/versions/$version/builds/$select_build/downloads/paper-$version-$select_build.jar" | grep "HTTP/2 404" >/dev/null; then
echo "Error: Invalid build selected: $select_build" echo "Error: Invalid build selected: $select_build"