Code cleanup

This commit is contained in:
Shoghi Cervantes
2014-08-21 17:26:41 +02:00
parent e1ef86074e
commit db7222976e
105 changed files with 932 additions and 896 deletions

View File

@ -20,6 +20,7 @@
*/
namespace pocketmine\scheduler;
use pocketmine\Server;
/**

View File

@ -168,9 +168,9 @@ class ServerScheduler{
private function addTask(Task $task, $delay, $period){
if($task instanceof PluginTask){
if(!($task->getOwner() instanceof Plugin)){
throw new \Exception("Invalid owner of PluginTask ".get_class($task));
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");
throw new \Exception("Plugin '" . $task->getOwner()->getName() . "' attempted to register a task while disabled");
}
}
@ -243,8 +243,10 @@ class ServerScheduler{
$task->onCompletion(Server::getInstance());
$task->setCompleted();
unset($this->asyncTaskStorage[$task->getTaskId()]);
return true;
}
return false;
}

View File

@ -154,6 +154,7 @@ class TaskHandler{
if($this->timingName !== null){
return $this->timingName;
}
return get_class($this->task);
}
}