maniacontrol quit on server stop
This commit is contained in:
parent
54f1855ea9
commit
f4b67accde
@ -5,6 +5,7 @@ namespace ManiaControl;
|
|||||||
use ManiaControl\Admin\ActionsMenu;
|
use ManiaControl\Admin\ActionsMenu;
|
||||||
use ManiaControl\Admin\AuthenticationManager;
|
use ManiaControl\Admin\AuthenticationManager;
|
||||||
use ManiaControl\Bills\BillManager;
|
use ManiaControl\Bills\BillManager;
|
||||||
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\Callbacks\Callbacks;
|
use ManiaControl\Callbacks\Callbacks;
|
||||||
use ManiaControl\Callbacks\TimerListener;
|
use ManiaControl\Callbacks\TimerListener;
|
||||||
@ -45,7 +46,7 @@ require_once __DIR__ . '/Libs/curl-easy/autoload.php';
|
|||||||
* @copyright 2014 ManiaControl Team
|
* @copyright 2014 ManiaControl Team
|
||||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||||
*/
|
*/
|
||||||
class ManiaControl implements CommandListener, TimerListener {
|
class ManiaControl implements CallbackListener, CommandListener, TimerListener {
|
||||||
/*
|
/*
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -297,6 +298,9 @@ class ManiaControl implements CommandListener, TimerListener {
|
|||||||
$this->quit("The Server has Version '{$version->build}', while at least '" . self::MIN_DEDIVERSION . "' is required!", true);
|
$this->quit("The Server has Version '{$version->build}', while at least '" . self::MIN_DEDIVERSION . "' is required!", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Listen for shutdown
|
||||||
|
$this->callbackManager->registerCallbackListener(CallbackManager::CB_MP_SERVERSTOP, $this, 'handleServerStopCallback');
|
||||||
|
|
||||||
// OnInit callback
|
// OnInit callback
|
||||||
$this->callbackManager->triggerCallback(Callbacks::ONINIT);
|
$this->callbackManager->triggerCallback(Callbacks::ONINIT);
|
||||||
|
|
||||||
@ -390,4 +394,13 @@ class ManiaControl implements CommandListener, TimerListener {
|
|||||||
usleep($sleepTime);
|
usleep($sleepTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle Server Stop Callback
|
||||||
|
*
|
||||||
|
* @param array $callback
|
||||||
|
*/
|
||||||
|
public function handleServerStopCallback(array $callback) {
|
||||||
|
$this->quit('The Server has been shut down!');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user