31 lines
736 B
Bash
31 lines
736 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [[ $# -lt 1 || $# -gt 2 ]]; then
|
|
echo "用法:$0 <服务端 JAR 路径> [端口]" >&2
|
|
exit 2
|
|
fi
|
|
|
|
project_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
run_directory="$project_root/run"
|
|
jar_path="$(realpath "$1")"
|
|
port="${2:-25565}"
|
|
|
|
mkdir -p "$run_directory"
|
|
cp -f "$jar_path" "$run_directory/infstar.jar"
|
|
|
|
cat > "$run_directory/server.properties" <<EOF
|
|
# Infstar 本地测试服务器配置
|
|
server-port=$port
|
|
motd=Infstar Local Test Server
|
|
online-mode=false
|
|
enable-command-block=true
|
|
spawn-protection=0
|
|
view-distance=8
|
|
simulation-distance=6
|
|
enable-rcon=false
|
|
EOF
|
|
|
|
printf '%s\n' 'eula=true' > "$run_directory/eula.txt"
|
|
echo "测试服务器已准备完成:$run_directory"
|