islandsurvivalcraft/test-server/start_process.ps1

10 lines
535 B
PowerShell

if (!(Test-Path -Path "paper.jar" -PathType Leaf)) {
Invoke-WebRequest -Uri "https://api.papermc.io/v2/projects/paper/versions/1.16.5/builds/794/downloads/paper-1.16.5-794.jar" -OutFile "paper.jar"
}
write-Output "Attempting to start Paper test server."
$SID = Start-Process java -ArgumentList "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=25566", "-Xms512M", "-Xmx1G", "-jar", "paper.jar", "nogui" -PassThru
$SID = $SID.Id
write-Output "Process started. PID is: $SID"
$SID | Out-File -FilePath "test-server.pid"