Listener: Drop support for @softDepend annotation

literally nobody uses this. I don't think anyone even knows it exists.
It's also an obstacle to separating event handler registration from PluginManager.
This commit is contained in:
Dylan K. Taylor 2020-10-16 21:10:57 +01:00
parent 792f38f474
commit d38791e27d
2 changed files with 3 additions and 15 deletions

View File

@ -43,9 +43,6 @@ use pocketmine\plugin\PluginManager;
* Functions which meet the criteria can have the following annotations in their doc comments:
*
* - `@notHandler`: Marks a function as NOT being an event handler. Only needed if the function meets the above criteria.
* - `@softDepend [PluginName]`: Handler WILL NOT be registered if its event doesn't exist. Useful for soft-depending
* on plugin events. Plugin name is optional.
* Example: `@softDepend SimpleAuth`
* - `@handleCancelled`: Cancelled events will STILL invoke this handler.
* - `@priority <PRIORITY>`: Sets the priority at which this event handler will receive events.
* Example: `@priority HIGHEST`

View File

@ -433,22 +433,13 @@ class PluginManager{
continue;
}
$handlerClosure = $method->getClosure($listener);
try{
$eventClass = $parameters[0]->getClass();
}catch(\ReflectionException $e){ //class doesn't exist
if(isset($tags["softDepend"]) && !isset($this->plugins[$tags["softDepend"]])){
$this->server->getLogger()->debug("Not registering @softDepend listener " . Utils::getNiceClosureName($handlerClosure) . "() because plugin \"" . $tags["softDepend"] . "\" not found");
continue;
}
throw $e;
}
$eventClass = $parameters[0]->getClass();
if($eventClass === null or !$eventClass->isSubclassOf(Event::class)){
continue;
}
$handlerClosure = $method->getClosure($listener);
try{
$priority = isset($tags["priority"]) ? EventPriority::fromString($tags["priority"]) : EventPriority::NORMAL;
}catch(\InvalidArgumentException $e){