mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-08 04:38:35 +00:00
Merge branch 'release/3.2' into release/3.3
This commit is contained in:
commit
243f86b0a0
@ -740,6 +740,24 @@ class PluginManager{
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$parameters = $method->getParameters();
|
||||||
|
if(count($parameters) !== 1){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
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 " . get_class($listener) . "::" . $method->getName() . "(" . $parameters[0]->getType()->getName() . ") because plugin \"" . $tags["softDepend"] . "\" not found");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
if($eventClass === null or !$eventClass->isSubclassOf(Event::class)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$priority = isset($tags["priority"]) ? EventPriority::fromString($tags["priority"]) : EventPriority::NORMAL;
|
$priority = isset($tags["priority"]) ? EventPriority::fromString($tags["priority"]) : EventPriority::NORMAL;
|
||||||
}catch(\InvalidArgumentException $e){
|
}catch(\InvalidArgumentException $e){
|
||||||
@ -761,21 +779,7 @@ class PluginManager{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$parameters = $method->getParameters();
|
$this->registerEvent($eventClass->getName(), $listener, $priority, new MethodEventExecutor($method->getName()), $plugin, $ignoreCancelled);
|
||||||
try{
|
|
||||||
$isHandler = count($parameters) === 1 && $parameters[0]->getClass() instanceof \ReflectionClass && is_subclass_of($parameters[0]->getClass()->getName(), Event::class);
|
|
||||||
}catch(\ReflectionException $e){
|
|
||||||
if(isset($tags["softDepend"]) && !isset($this->plugins[$tags["softDepend"]])){
|
|
||||||
$this->server->getLogger()->debug("Not registering @softDepend listener " . get_class($listener) . "::" . $method->getName() . "(" . $parameters[0]->getType()->getName() . ") because plugin \"" . $tags["softDepend"] . "\" not found");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
if($isHandler){
|
|
||||||
$class = $parameters[0]->getClass()->getName();
|
|
||||||
$this->registerEvent($class, $listener, $priority, new MethodEventExecutor($method->getName()), $plugin, $ignoreCancelled);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user