Fixed client crashing (temp.), fixed clients not spawning. (Fixes #1640 #1636 #1590 #1573)

This commit is contained in:
Shoghi Cervantes
2014-07-14 02:19:14 +02:00
parent eccd82ca4b
commit 6c442551f7
8 changed files with 89 additions and 73 deletions

View File

@ -29,22 +29,18 @@ use pocketmine\Server;
*/
abstract class AsyncTask extends \Threaded{
private $complete = null;
private $finished = null;
private $result = null;
public $complete = null;
public $finished = null;
public $result = null;
public function run(){
$this->lock();
$this->finished = false;
$this->complete = false;
$this->result = null;
$this->unlock();
$this->onRun();
$this->lock();
$this->finished = true;
$this->unlock();
}
@ -52,7 +48,6 @@ abstract class AsyncTask extends \Threaded{
* @return bool
*/
public function isFinished(){
return $this->finished === true;
}
@ -88,6 +83,14 @@ abstract class AsyncTask extends \Threaded{
$this->result = @serialize($result);
}
public function setTaskId($taskId){
$this->taskId = $taskId;
}
public function getTaskId(){
return $this->taskId;
}
/**
* Actions to execute when run
*