Skip to content

Instantly share code, notes, and snippets.

@AntumDeluge
Last active April 23, 2020 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AntumDeluge/a85009fe0da3cb8a8ffdc9f03d888449 to your computer and use it in GitHub Desktop.
Save AntumDeluge/a85009fe0da3cb8a8ffdc9f03d888449 to your computer and use it in GitHub Desktop.
PowerShell script for launching Stendhal server
<#
Public Domain dedication:
The author hereby relinquishes all rights to this work & dedicates
it to the Public Domain via Creative Commons Zero (CC0). See:
https://creativecommons.org/licenses/publicdomain/
#>
# change this path to root installation directory of Stendhal server
$server_root = "."
if (Test-Path -Path $server_root -PathType Leaf) {
Write-Host "`"$server_root`" is a file"
# EEXIST
exit 17
}
if (!(Test-Path -Path $server_root -PathType Container)) {
Write-Host "`"$server_root`" does not exist"
# ENOENT
exit 2
}
$CLASSPATH = ".;.\build\build_server\;.\build\build_server_maps\;.\build_build_server_mods\;.\build\build_server_script\;.\build\build_server_xmlconf\;.\libs\*"
<#
Some influencial properties (use: -Dproperty)
NOTE: for PowerShell, arguments containing a "." must be surrounded in quotes
Occasions:
stendhal.testserver: put in test server mode
stendhal.christmas: loads Christmas maps
stendhal.santa: enables Santa NPC
stendhal.easter: loads Easter maps
stendhal.easterbunny: enables Easter Bunny NPC
stendhal.minetown: loads Minetown Weeks maps
Testing:
DEBUG: general debugging
testing: general testing
testing.action: player action tests
testing.chat: chat system tests
testing.combat: combat system tests
testing.movement: entity movement tests
testing.outfit: outfit system tests
testing.quest: quest system tests
#>
$params = "-cp","$CLASSPATH" + $args + "games.stendhal.server.StendhalServer"
Write-Host "`nExecuting Stendhal server: java $params`n"
$proc = Start-Process -PassThru -NoNewWindow -WorkingDirectory "$server_root" -FilePath "java" -ArgumentList $params
Wait-Process $proc.Id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment