-
Notifications
You must be signed in to change notification settings - Fork 20
/
start.ps1
48 lines (42 loc) · 1.09 KB
/
start.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
[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 "Ядро установлено некорректно!"
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 "Чтобы выйти из цикла, нажмите CTRL + C сейчас. В ином случае подождите 5 секунд, пока сервер не перезагрузится."
echo ""
Start-Sleep 5
StartServer
}