Use Utils::getNiceClosureName() in PluginManager

This commit is contained in:
Dylan K. Taylor 2018-11-11 19:50:07 +00:00
parent 788b278fc3
commit 46d9475568

View File

@ -710,11 +710,14 @@ class PluginManager{
if(count($parameters) !== 1){ if(count($parameters) !== 1){
continue; continue;
} }
$handlerClosure = $method->getClosure($listener);
try{ try{
$eventClass = $parameters[0]->getClass(); $eventClass = $parameters[0]->getClass();
}catch(\ReflectionException $e){ //class doesn't exist }catch(\ReflectionException $e){ //class doesn't exist
if(isset($tags["softDepend"]) && !isset($this->plugins[$tags["softDepend"]])){ 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"); $this->server->getLogger()->debug("Not registering @softDepend listener " . Utils::getNiceClosureName($handlerClosure) . "(" . $parameters[0]->getType()->getName() . ") because plugin \"" . $tags["softDepend"] . "\" not found");
continue; continue;
} }
@ -727,7 +730,7 @@ class PluginManager{
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){
throw new PluginException("Event handler " . get_class($listener) . "->" . $method->getName() . "() declares invalid/unknown priority \"" . $tags["priority"] . "\""); throw new PluginException("Event handler " . Utils::getNiceClosureName($handlerClosure) . "() declares invalid/unknown priority \"" . $tags["priority"] . "\"");
} }
$ignoreCancelled = false; $ignoreCancelled = false;
@ -741,7 +744,7 @@ class PluginManager{
$ignoreCancelled = false; $ignoreCancelled = false;
break; break;
default: default:
throw new PluginException("Event handler " . get_class($listener) . "->" . $method->getName() . "() declares invalid @ignoreCancelled value \"" . $tags["ignoreCancelled"] . "\""); throw new PluginException("Event handler " . Utils::getNiceClosureName($handlerClosure) . "() declares invalid @ignoreCancelled value \"" . $tags["ignoreCancelled"] . "\"");
} }
} }