Fixed players and entities getting despawned

This commit is contained in:
Shoghi Cervantes 2014-06-23 15:25:44 +02:00
parent fd4fc4ff94
commit 31a7410acd
2 changed files with 4 additions and 3 deletions

View File

@ -610,8 +610,9 @@ abstract class Entity extends Position implements Metadatable{
$pk->started = $this->getLevel()->stopTime == false; $pk->started = $this->getLevel()->stopTime == false;
$this->dataPacket($pk); $this->dataPacket($pk);
} }
$this->spawnToAll();
$this->chunk = null; $this->chunk = null;
return true;
} }
public function getPosition(){ public function getPosition(){

View File

@ -275,7 +275,7 @@ class Level implements ChunkManager, Metadatable{
public function useChunk($X, $Z, Player $player){ public function useChunk($X, $Z, Player $player){
$index = Level::chunkHash($X, $Z); $index = Level::chunkHash($X, $Z);
$this->loadChunk($X, $Z); $this->loadChunk($X, $Z);
$this->usedChunks[$index][spl_object_hash($player)] = $player; $this->usedChunks[$index][$player->getID()] = $player;
} }
/** /**
@ -299,7 +299,7 @@ class Level implements ChunkManager, Metadatable{
* @param Player $player * @param Player $player
*/ */
public function freeChunk($X, $Z, Player $player){ public function freeChunk($X, $Z, Player $player){
unset($this->usedChunks[Level::chunkHash($X, $Z)][spl_object_hash($player)]); unset($this->usedChunks[Level::chunkHash($X, $Z)][$player->getID()]);
} }
/** /**