# Starts the server. Needs rsx-protocol and rsx-auth built first. # # ASCII only, for the same reason as the other scripts. # # run-server.ps1 [-Port 25565] [-Accounts path] [-Capacity 200] [-World path] param( [int]$Port = 25565, [string]$Accounts = '', [int]$Capacity = 200, [string]$Name = 'RustNotMC', [string]$Motd = 'a survival game', [string]$Register = '', [string]$Password = '', [string]$World = '', [long]$Seed = 0 ) $ErrorActionPreference = 'Stop' $Repo = Split-Path -Parent $PSScriptRoot if (-not $Repo) { $Repo = $PSCommandPath | Split-Path -Parent | Split-Path -Parent } $Workspace = Split-Path -Parent $Repo $Protocol = Join-Path $Workspace 'rsx-protocol\build\classes' $Auth = Join-Path $Workspace 'rsx-auth\build\classes' $Server = Join-Path $Repo 'build\classes' foreach ($dep in @($Protocol, $Auth, $Server)) { if (-not (Test-Path $dep)) { Write-Host " Missing: $dep" -ForegroundColor Red Write-Host ' Build rsx-protocol, rsx-auth and rsx-server-core first.' -ForegroundColor Red exit 1 } } if (-not $Accounts) { $Accounts = Join-Path $Repo 'accounts.txt' } if (-not $World) { $World = Join-Path $Repo 'world' } if ($Register) { & java -cp "$Protocol;$Auth;$Server" net.rustnotmc.server.ServerMain ` --accounts $Accounts --register $Register --password $Password exit $LASTEXITCODE } Write-Host ' rsx-protocol ' -NoNewline Write-Host (Split-Path -Leaf $Protocol) -ForegroundColor DarkGray Write-Host ' rsx-auth ' -NoNewline Write-Host (Split-Path -Leaf $Auth) -ForegroundColor DarkGray Write-Host ' rsx-server-core ' -NoNewline Write-Host (Split-Path -Leaf $Server) -ForegroundColor DarkGray Write-Host '' Write-Host " accounts : $Accounts" Write-Host " world : $World" Write-Host " seed : $Seed" Write-Host " port : $Port" Write-Host " capacity : $Capacity" Write-Host '' & java -cp "$Protocol;$Auth;$Server" net.rustnotmc.server.ServerMain ` --port $Port --accounts $Accounts --capacity $Capacity --name $Name --motd $Motd ` --world $World --seed $Seed exit $LASTEXITCODE