2021-07-20 21:48:50 +00:00
|
|
|
|
|
|
|
#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;
|
2021-07-16 15:23:12 +00:00
|
|
|
}
|
|
|
|
|
2021-07-20 21:48:50 +00:00
|
|
|
Write-Host "Starting server locally"
|
|
|
|
|
|
|
|
if ($r) {
|
|
|
|
Write-Host "Rebuild flag (-r) given. Rebuilding from source...";
|
2021-07-16 15:23:12 +00:00
|
|
|
try {
|
2021-07-20 21:48:50 +00:00
|
|
|
.\gradlew Server:jar;
|
2021-07-16 15:23:12 +00:00
|
|
|
} catch {
|
2021-07-20 21:48:50 +00:00
|
|
|
Write-Host "There was a problem with the gradle build. Trying to start server anyways...";
|
2021-07-16 15:23:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-20 21:48:50 +00:00
|
|
|
# Check for the server directory
|
|
|
|
|
|
|
|
if (-not(Test-Path $path)) {
|
|
|
|
Write-Host "The jarfile that was requested doesn't seem to exist. Terminating...";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2021-07-16 15:23:12 +00:00
|
|
|
try {
|
2021-07-20 21:48:50 +00:00
|
|
|
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
|
2021-07-16 15:23:12 +00:00
|
|
|
} catch {
|
|
|
|
Write-Host "Couldn't execute. Is Java installed?"
|
2021-07-20 21:48:50 +00:00
|
|
|
}
|
|
|
|
|