From d5c27029086fbdcd49a56564f9ea8055e5cdf310 Mon Sep 17 00:00:00 2001 From: PEMapModder Date: Mon, 10 Aug 2015 22:14:11 +0800 Subject: [PATCH] Update PluginManager.php --- src/pocketmine/plugin/PluginManager.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/plugin/PluginManager.php b/src/pocketmine/plugin/PluginManager.php index eaa40dd90..5c746cb16 100644 --- a/src/pocketmine/plugin/PluginManager.php +++ b/src/pocketmine/plugin/PluginManager.php @@ -748,9 +748,15 @@ class PluginManager{ * @throws PluginException */ public function registerEvent($event, Listener $listener, $priority, EventExecutor $executor, Plugin $plugin, $ignoreCancelled = false){ + if(!is_subclass_of($event, Event::class)){ + throw new PluginException($event . " is not an Event"); + } $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"); + 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(!$plugin->isEnabled()){