39 lines
1.2 KiB
PowerShell
39 lines
1.2 KiB
PowerShell
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[ValidateScript({ Test-Path -LiteralPath $_ -PathType Leaf })]
|
|
[string] $JarPath,
|
|
[int] $Port = 25565
|
|
)
|
|
|
|
$projectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
|
|
$runDirectory = Join-Path $projectRoot "run"
|
|
$targetJar = Join-Path $runDirectory "infstar.jar"
|
|
|
|
New-Item -ItemType Directory -Path $runDirectory -Force | Out-Null
|
|
Copy-Item -LiteralPath (Resolve-Path $JarPath).Path -Destination $targetJar -Force
|
|
|
|
@"
|
|
# 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
|
|
"@ | Set-Content -LiteralPath (Join-Path $runDirectory "server.properties") -Encoding utf8
|
|
|
|
"eula=true" | Set-Content -LiteralPath (Join-Path $runDirectory "eula.txt") -Encoding ascii
|
|
|
|
@"
|
|
这是 Infstar 的本地测试服务器目录,不应提交到 Git 仓库。
|
|
|
|
启动方式:
|
|
..\scripts\start-test-server.ps1
|
|
|
|
该目录包含世界、日志、配置和构建产物,已通过 .gitignore 排除。
|
|
"@ | Set-Content -LiteralPath (Join-Path $runDirectory "README.txt") -Encoding utf8
|
|
|
|
Write-Output "测试服务器已准备完成:$runDirectory"
|