- use a Bash shebang instead of the one for sh,
as the script is Bash, not POSIX sh
- fix shellcheck warnings and errors:
- SC2046 (warning): Quote to prevent word splitting.
- SC2164 (warning): Use 'cd ... || exit' in case cd fails.
- SC2068 (error): Double quote array expansions to avoid
re-splitting elements.
26 lines
639 B
Bash
Executable file
26 lines
639 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
STENDHAL_VERSION="1.45.5"
|
|
SERVER_JAR="stendhal-server-${STENDHAL_VERSION}.jar"
|
|
|
|
# change to server directory
|
|
cd "$(dirname "$0")" || exit
|
|
|
|
# parse arguments
|
|
vm_args=()
|
|
app_args=()
|
|
for arg in "$@"; do
|
|
if [[ "${arg}" =~ ^-D ]]; then
|
|
vm_args+=("${arg}")
|
|
else
|
|
app_args+=("${arg}")
|
|
fi
|
|
done
|
|
|
|
if [ -f "${SERVER_JAR}" ]; then
|
|
LOCALCLASSPATH="./${SERVER_JAR}:./libs/*"
|
|
else
|
|
LOCALCLASSPATH=".:./build/build_server:./build/build_server_maps:./build/build_server_script:./build/build_server_xmlconf:./libs/*"
|
|
fi
|
|
|
|
java -Xmx400m -cp "${LOCALCLASSPATH}" "${vm_args[@]}" games.stendhal.server.StendhalServer "${app_args[@]}"
|