mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
Disallow plugins disabling other plugins (#5872)
This commit is contained in:
parent
0d8a06732a
commit
1ffa945fbf
@ -486,6 +486,7 @@ class PluginManager{
|
|||||||
return true; //TODO: maybe this should be an error?
|
return true; //TODO: maybe this should be an error?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
public function disablePlugins() : void{
|
public function disablePlugins() : void{
|
||||||
while(count($this->enabledPlugins) > 0){
|
while(count($this->enabledPlugins) > 0){
|
||||||
foreach($this->enabledPlugins as $plugin){
|
foreach($this->enabledPlugins as $plugin){
|
||||||
@ -503,7 +504,7 @@ class PluginManager{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disablePlugin(Plugin $plugin) : void{
|
private function disablePlugin(Plugin $plugin) : void{
|
||||||
if($plugin->isEnabled()){
|
if($plugin->isEnabled()){
|
||||||
$this->server->getLogger()->info($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_disable($plugin->getDescription()->getFullName())));
|
$this->server->getLogger()->info($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_disable($plugin->getDescription()->getFullName())));
|
||||||
(new PluginDisableEvent($plugin))->call();
|
(new PluginDisableEvent($plugin))->call();
|
||||||
@ -532,13 +533,6 @@ class PluginManager{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function clearPlugins() : void{
|
|
||||||
$this->disablePlugins();
|
|
||||||
$this->plugins = [];
|
|
||||||
$this->enabledPlugins = [];
|
|
||||||
$this->fileAssociations = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the given ReflectionMethod could be used as an event handler. Used to filter methods on Listeners
|
* Returns whether the given ReflectionMethod could be used as an event handler. Used to filter methods on Listeners
|
||||||
* when registering.
|
* when registering.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user