Improved checks for event registration

This commit is contained in:
Dylan K. Taylor 2017-05-14 12:07:15 +01:00
parent 4a9acf564c
commit dbb8e8ad0a

View File

@ -754,8 +754,15 @@ class PluginManager{
if($class->isAbstract()){
throw new PluginException($event . " is an abstract Event");
}
if($class->getProperty("handlerList")->getDeclaringClass()->getName() !== $event){
throw new PluginException($event . " does not have a handler list");
if(!$class->hasProperty("handlerList") or ($property = $class->getProperty("handlerList"))->getDeclaringClass()->getName() !== $event){
throw new PluginException($event . " does not have a valid handler list");
}
if(!$property->isStatic()){
throw new PluginException($event . " handlerList property is not static");
}
if(!$property->isPublic()){
throw new PluginException($event . " handlerList property is not public");
}
if(!$plugin->isEnabled()){