#if ($Args[0] -eq "-r") { # Write-Host "Rebuilding application" # $build = $true #} else { # Write-Host "No rebuild flag (-r) given. Starting directly..." # $build = $false #} param ( [string]$port = 1218, [string]$path = "Server/build/libs/Server.jar", [switch]$r = $false, [switch]$h = $false ) if ($h) { Write-Host "Script to start the server on the local machine."; Write-Host " Flags: -h (help), -r (rebuild from source using Gradle),"; Write-Host " -path [somePath] (start jarfile at non-standard location)"; Write-Host " -port [somePortNumber] (start server at the given port)"; exit; } Write-Host "Starting server locally" if ($r) { Write-Host "Rebuild flag (-r) given. Rebuilding from source..."; try { .\gradlew Server:jar; } catch { Write-Host "There was a problem with the gradle build. Trying to start server anyways..."; } } # Check for the server directory if (-not(Test-Path $path)) { Write-Host "The jarfile that was requested doesn't seem to exist. Terminating..."; exit; } try { Write-Host "Starting server at location $($path) on port $($port)" java -jar Server/build/libs/Server.jar ` -c .\configs\marvelheros.character.json ` -m.\configs\matchconfig_1.game.json ` -s .\configs\asgard.scenario.json ` -v ` -p $port } catch { Write-Host "Couldn't execute. Is Java installed?" }