mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 03:08:58 +00:00
Moved exception handler to a big try catch
This commit is contained in:
parent
e137ac4c56
commit
922e9d93d5
@ -1445,9 +1445,7 @@ class Server{
|
|||||||
|
|
||||||
public static function microSleep(int $microseconds){
|
public static function microSleep(int $microseconds){
|
||||||
Server::$sleeper->synchronized(function(int $ms){
|
Server::$sleeper->synchronized(function(int $ms){
|
||||||
var_dump("Sleeping $ms");
|
|
||||||
Server::$sleeper->wait($ms);
|
Server::$sleeper->wait($ms);
|
||||||
var_dump("Finished sleep $ms");
|
|
||||||
}, $microseconds);
|
}, $microseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1461,9 +1459,11 @@ class Server{
|
|||||||
public function __construct(\ClassLoader $autoloader, \ThreadedLogger $logger, $filePath, $dataPath, $pluginPath){
|
public function __construct(\ClassLoader $autoloader, \ThreadedLogger $logger, $filePath, $dataPath, $pluginPath){
|
||||||
self::$instance = $this;
|
self::$instance = $this;
|
||||||
self::$sleeper = \ThreadedFactory::create();
|
self::$sleeper = \ThreadedFactory::create();
|
||||||
|
|
||||||
$this->autoloader = $autoloader;
|
$this->autoloader = $autoloader;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
$this->filePath = $filePath;
|
$this->filePath = $filePath;
|
||||||
if(!file_exists($dataPath . "worlds/")){
|
if(!file_exists($dataPath . "worlds/")){
|
||||||
mkdir($dataPath . "worlds/", 0777);
|
mkdir($dataPath . "worlds/", 0777);
|
||||||
@ -1635,7 +1635,6 @@ class Server{
|
|||||||
$this->pluginManager->registerInterface(PharPluginLoader::class);
|
$this->pluginManager->registerInterface(PharPluginLoader::class);
|
||||||
$this->pluginManager->registerInterface(ScriptPluginLoader::class);
|
$this->pluginManager->registerInterface(ScriptPluginLoader::class);
|
||||||
|
|
||||||
set_exception_handler([$this, "exceptionHandler"]);
|
|
||||||
register_shutdown_function([$this, "crashDump"]);
|
register_shutdown_function([$this, "crashDump"]);
|
||||||
|
|
||||||
$this->queryRegenerateTask = new QueryRegenerateEvent($this, 5);
|
$this->queryRegenerateTask = new QueryRegenerateEvent($this, 5);
|
||||||
@ -1710,6 +1709,9 @@ class Server{
|
|||||||
$this->enablePlugins(PluginLoadOrder::POSTWORLD);
|
$this->enablePlugins(PluginLoadOrder::POSTWORLD);
|
||||||
|
|
||||||
$this->start();
|
$this->start();
|
||||||
|
}catch(\Throwable $e){
|
||||||
|
$this->exceptionHandler($e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user