diff --git a/PocketMine-MP.php b/PocketMine-MP.php index fd6c2ed2..a20aa4de 100644 --- a/PocketMine-MP.php +++ b/PocketMine-MP.php @@ -48,3 +48,5 @@ while(true){ console("[NOTICE] The server is restarting... (".gc_collect_cycles()." cycles collected)", true, true, 0); } } + +kill(getmypid()); \ No newline at end of file diff --git a/src/common/functions.php b/src/common/functions.php index e02fea83..2a1c3e79 100644 --- a/src/common/functions.php +++ b/src/common/functions.php @@ -25,6 +25,22 @@ the Free Software Foundation, either version 3 of the License, or */ +function kill($pid){ + switch(Utils::getOS()){ + case "win": + ob_start(); + passthru("%WINDIR%\\System32\\taskkill.exe /F /PID ".((int) $pid)); + ob_end_clean(); + break; + case "mac": + case "linux": + default: + ob_start(); + passthru("kill -9 ".((int) $pid)); + ob_end_clean(); + } +} + function require_all($path, &$count = 0){ $dir = dir($path."/");