mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 10:19:39 +00:00
Fixed DevTools getting disabled when a plugin throws an exception during load (#1025)
This commit is contained in:
parent
f0d12a0b30
commit
3f03d9e683
@ -140,7 +140,7 @@ class PluginManager{
|
|||||||
* @param string $path
|
* @param string $path
|
||||||
* @param PluginLoader[] $loaders
|
* @param PluginLoader[] $loaders
|
||||||
*
|
*
|
||||||
* @return Plugin
|
* @return Plugin|null
|
||||||
*/
|
*/
|
||||||
public function loadPlugin($path, $loaders = null){
|
public function loadPlugin($path, $loaders = null){
|
||||||
foreach(($loaders === null ? $this->fileAssociations : $loaders) as $loader){
|
foreach(($loaders === null ? $this->fileAssociations : $loaders) as $loader){
|
||||||
@ -154,16 +154,21 @@ class PluginManager{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($plugin = $loader->loadPlugin($path)) instanceof Plugin){
|
try{
|
||||||
$this->plugins[$plugin->getDescription()->getName()] = $plugin;
|
if(($plugin = $loader->loadPlugin($path)) instanceof Plugin){
|
||||||
|
$this->plugins[$plugin->getDescription()->getName()] = $plugin;
|
||||||
|
|
||||||
$pluginCommands = $this->parseYamlCommands($plugin);
|
$pluginCommands = $this->parseYamlCommands($plugin);
|
||||||
|
|
||||||
if(count($pluginCommands) > 0){
|
if(count($pluginCommands) > 0){
|
||||||
$this->commandMap->registerAll($plugin->getDescription()->getName(), $pluginCommands);
|
$this->commandMap->registerAll($plugin->getDescription()->getName(), $pluginCommands);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $plugin;
|
||||||
}
|
}
|
||||||
|
}catch(\Throwable $e){
|
||||||
return $plugin;
|
$this->server->getLogger()->logException($e);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user