From 67940ad6ab4b9632823a749a9e7fa973d4500620 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 9 Jan 2017 13:16:46 +0000 Subject: [PATCH] Added PowerShell start script with loop capability, mainly useful for Win10 users (#240) --- start.ps1 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 start.ps1 diff --git a/start.ps1 b/start.ps1 new file mode 100644 index 000000000..1b94da0ca --- /dev/null +++ b/start.ps1 @@ -0,0 +1,40 @@ +param ( + [switch]$Loop = $false +) + +if(Test-Path "bin\php\php.exe"){ + $env:PHPRC = "" + $binary = "bin\php\php.exe" +}else{ + $binary = "php" +} + +if(Test-Path "PocketMine-MP.phar"){ + $file = "PocketMine-MP.phar" +}elseif(Test-Path "src\pocketmine\PocketMine.php"){ + $file = "src\pocketmine\PocketMine.php" +}else{ + echo "Couldn't find a valid PocketMine-MP installation" + pause + exit 1 +} + +function StartServer{ + $command = $binary + " " + $file + " --enable-ansi" + iex $command +} + +$loops = 0 + +StartServer + +while($Loop){ + if($loops -ne 0){ + echo ("Restarted " + $loops + " times") + } + $loops++ + echo "To escape the loop, press CTRL+C now. Otherwise, wait 5 seconds for the server to restart." + echo "" + Start-Sleep 5 + StartServer +} \ No newline at end of file