mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-21 04:54:41 +00:00
Update PluginManager.php
This commit is contained in:
parent
ff16f2ef05
commit
d5c2702908
@ -748,9 +748,15 @@ class PluginManager{
|
|||||||
* @throws PluginException
|
* @throws PluginException
|
||||||
*/
|
*/
|
||||||
public function registerEvent($event, Listener $listener, $priority, EventExecutor $executor, Plugin $plugin, $ignoreCancelled = false){
|
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);
|
$class = new \ReflectionClass($event);
|
||||||
if(!is_subclass_of($event, Event::class) or $class->isAbstract() or $class->getProperty("handlerList")->getDeclaringClass()->getName() !== $event){
|
if($class->isAbstract()){
|
||||||
throw new PluginException($event . " is not a valid Event");
|
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()){
|
if(!$plugin->isEnabled()){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user