Added new exception when a plugin creates an orphaned PluginTask

This commit is contained in:
Shoghi Cervantes 2014-07-28 20:24:35 +02:00
parent 81faddafb0
commit e97139919a

View File

@ -166,8 +166,12 @@ class ServerScheduler{
* @throws \Exception
*/
private function addTask(Task $task, $delay, $period){
if($task instanceof PluginTask and !$task->getOwner()->isEnabled()){
throw new \Exception("Plugin attempted to register a task while disabled");
if($task instanceof PluginTask){
if(!($task->getOwner() instanceof Plugin)){
throw new \Exception("Invalid owner of PluginTask ".get_class($task));
}elseif(!$task->getOwner()->isEnabled()){
throw new \Exception("Plugin '".$task->getOwner()->getName()."' attempted to register a task while disabled");
}
}
if($delay <= 0){