Initialize Infstar Paper-based server core

This commit is contained in:
Coldsmiles
2026-09-13 18:08:00 +08:00
commit 5c27681d1d
22 changed files with 1502 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
param(
[int] $MemoryMinGb = 2,
[int] $MemoryMaxGb = 4
)
$projectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
$runDirectory = Join-Path $projectRoot "run"
$serverJar = Join-Path $runDirectory "infstar.jar"
if (-not (Test-Path -LiteralPath $serverJar -PathType Leaf)) {
throw "未找到 $serverJar。请先运行 prepare-test-server.ps1。"
}
$java = Get-Command java -ErrorAction SilentlyContinue
if ($null -eq $java) {
throw "未找到 Java。Infstar 26.2 需要 Java 25。"
}
Push-Location $runDirectory
try {
& $java.Source "-Xms${MemoryMinGb}G" "-Xmx${MemoryMaxGb}G" "-jar" $serverJar "--nogui"
if ($LASTEXITCODE -ne 0) {
throw "测试服务器退出,代码:$LASTEXITCODE"
}
}
finally {
Pop-Location
}