mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 18:59:00 +00:00
Disallow registration of events without handlerList
This commit is contained in:
parent
2df901b064
commit
ff16f2ef05
@ -748,7 +748,8 @@ class PluginManager{
|
||||
* @throws PluginException
|
||||
*/
|
||||
public function registerEvent($event, Listener $listener, $priority, EventExecutor $executor, Plugin $plugin, $ignoreCancelled = false){
|
||||
if(!is_subclass_of($event, Event::class) or (new \ReflectionClass($event))->isAbstract()){
|
||||
$class = new \ReflectionClass($event);
|
||||
if(!is_subclass_of($event, Event::class) or $class->isAbstract() or $class->getProperty("handlerList")->getDeclaringClass()->getName() !== $event){
|
||||
throw new PluginException($event . " is not a valid Event");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user