PocketMine-MP/start.ps1
Dylan T 8cc2a4ce5d
Remove start script support for source-code installations (#2495)
This was suggested recently by @TheDeibo. We don't want users running source-code installations unless they are developers, and developers should know how to boot a source-code installation anyway.
2018-11-04 23:31:57 +00:00

46 lines
902 B
PowerShell

[CmdletBinding(PositionalBinding=$false)]
param (
[string]$php = "",
[switch]$Loop = $false,
[string]$file = "",
[string][Parameter(ValueFromRemainingArguments)]$extraPocketMineArgs
)
if($php -ne ""){
$binary = $php
}elseif(Test-Path "bin\php\php.exe"){
$env:PHPRC = ""
$binary = "bin\php\php.exe"
}else{
$binary = "php"
}
if($file -eq ""){
if(Test-Path "PocketMine-MP.phar"){
$file = "PocketMine-MP.phar"
}else{
echo "Couldn't find a valid PocketMine-MP installation"
pause
exit 1
}
}
function StartServer{
$command = "powershell -NoProfile " + $binary + " " + $file + " " + $extraPocketMineArgs
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
}