mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 09:49:50 +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 PluginLoader[] $loaders
|
||||
*
|
||||
* @return Plugin
|
||||
* @return Plugin|null
|
||||
*/
|
||||
public function loadPlugin($path, $loaders = null){
|
||||
foreach(($loaders === null ? $this->fileAssociations : $loaders) as $loader){
|
||||
@ -154,16 +154,21 @@ class PluginManager{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(($plugin = $loader->loadPlugin($path)) instanceof Plugin){
|
||||
$this->plugins[$plugin->getDescription()->getName()] = $plugin;
|
||||
try{
|
||||
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){
|
||||
$this->commandMap->registerAll($plugin->getDescription()->getName(), $pluginCommands);
|
||||
if(count($pluginCommands) > 0){
|
||||
$this->commandMap->registerAll($plugin->getDescription()->getName(), $pluginCommands);
|
||||
}
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
|
||||
return $plugin;
|
||||
}catch(\Throwable $e){
|
||||
$this->server->getLogger()->logException($e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user