mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 16:24:05 +00:00
This allows specifying a PocketMine-MP PHP file to execute (phar or source) to use to run the server, like start.sh. If not specified, auto-detection is used.
48 lines
989 B
PowerShell
48 lines
989 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"
|
|
}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 = "powershell " + $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
|
|
} |