From 094234dc0f80f4a7019e5a22473eef9c05eee4c7 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sun, 19 Apr 2015 15:37:18 +0200 Subject: [PATCH] Updated references and submodules --- src/pocketmine/Player.php | 2 +- src/pocketmine/level/format/FullChunk.php | 22 +++++++------- src/pocketmine/level/format/anvil/Chunk.php | 4 +-- .../level/format/anvil/ChunkRequestTask.php | 3 +- .../level/format/anvil/ChunkSection.php | 16 +++++----- .../level/format/generic/BaseChunk.php | 16 +++++----- .../level/format/generic/BaseFullChunk.php | 30 +++++++++---------- src/pocketmine/level/format/leveldb/Chunk.php | 6 ++-- .../level/format/mcregion/Chunk.php | 11 ++++--- .../level/format/mcregion/RegionLoader.php | 4 +-- src/pocketmine/nbt/NBT.php | 14 ++++----- src/pocketmine/nbt/tag/ByteArray.php | 7 ----- src/pocketmine/nbt/tag/NamedTag.php | 2 +- src/pocketmine/nbt/tag/String.php | 2 +- .../network/CompressBatchedTask.php | 2 +- src/pocketmine/network/RakLibInterface.php | 2 +- .../network/protocol/DataPacket.php | 10 +++---- src/raklib | 2 +- src/spl | 2 +- 19 files changed, 74 insertions(+), 83 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 1be321b96..f31bd56fc 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -592,7 +592,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $pk = new FullChunkDataPacket(); $pk->chunkX = $x; $pk->chunkZ = $z; - $pk->data =& $payload; + $pk->data = $payload; $this->batchDataPacket($pk->setChannel(Network::CHANNEL_WORLD_CHUNKS)); if($this->spawned){ diff --git a/src/pocketmine/level/format/FullChunk.php b/src/pocketmine/level/format/FullChunk.php index 8d86bde47..548d8235e 100644 --- a/src/pocketmine/level/format/FullChunk.php +++ b/src/pocketmine/level/format/FullChunk.php @@ -288,29 +288,29 @@ interface FullChunk{ /** * @return string[] */ - public function &getBiomeIdArray(); + public function getBiomeIdArray(); /** * @return int[] */ - public function &getBiomeColorArray(); + public function getBiomeColorArray(); /** * @return int[] */ - public function &getHeightMapArray(); + public function getHeightMapArray(); - public function &getBlockIdArray(); + public function getBlockIdArray(); - public function &getBlockDataArray(); + public function getBlockDataArray(); - public function &getBlockSkyLightArray(); + public function getBlockSkyLightArray(); - public function &getBlockLightArray(); + public function getBlockLightArray(); - public function &toBinary(); + public function toBinary(); - public function &toFastBinary(); + public function toFastBinary(); /** * @return boolean @@ -328,7 +328,7 @@ interface FullChunk{ * * @return FullChunk */ - public static function fromBinary(&$data, LevelProvider $provider = null); + public static function fromBinary($data, LevelProvider $provider = null); /** * @param string $data @@ -336,6 +336,6 @@ interface FullChunk{ * * @return FullChunk */ - public static function fromFastBinary(&$data, LevelProvider $provider = null); + public static function fromFastBinary($data, LevelProvider $provider = null); } \ No newline at end of file diff --git a/src/pocketmine/level/format/anvil/Chunk.php b/src/pocketmine/level/format/anvil/Chunk.php index 7bb8fb664..e50becebf 100644 --- a/src/pocketmine/level/format/anvil/Chunk.php +++ b/src/pocketmine/level/format/anvil/Chunk.php @@ -135,7 +135,7 @@ class Chunk extends BaseChunk{ * * @return Chunk */ - public static function fromBinary(&$data, LevelProvider $provider = null){ + public static function fromBinary($data, LevelProvider $provider = null){ $nbt = new NBT(NBT::BIG_ENDIAN); try{ @@ -152,7 +152,7 @@ class Chunk extends BaseChunk{ } } - public function &toBinary(){ + public function toBinary(){ $nbt = clone $this->getNBT(); $nbt->xPos = new Int("xPos", $this->x); diff --git a/src/pocketmine/level/format/anvil/ChunkRequestTask.php b/src/pocketmine/level/format/anvil/ChunkRequestTask.php index c57ade817..1145a1db2 100644 --- a/src/pocketmine/level/format/anvil/ChunkRequestTask.php +++ b/src/pocketmine/level/format/anvil/ChunkRequestTask.php @@ -133,8 +133,7 @@ class ChunkRequestTask extends AsyncTask{ public function onCompletion(Server $server){ $level = $server->getLevel($this->levelId); if($level instanceof Level and $this->hasResult()){ - $result = $this->getResult(); - $level->chunkRequestCallback($this->chunkX, $this->chunkZ, $result); + $level->chunkRequestCallback($this->chunkX, $this->chunkZ, $this->getResult()); } } diff --git a/src/pocketmine/level/format/anvil/ChunkSection.php b/src/pocketmine/level/format/anvil/ChunkSection.php index 2bbf75257..bb42a551d 100644 --- a/src/pocketmine/level/format/anvil/ChunkSection.php +++ b/src/pocketmine/level/format/anvil/ChunkSection.php @@ -155,7 +155,7 @@ class ChunkSection implements \pocketmine\level\format\ChunkSection{ } } - public function &getBlockIdColumn($x, $z){ + public function getBlockIdColumn($x, $z){ $i = ($z << 4) + $x; $column = ""; for($y = 0; $y < 16; ++$y){ @@ -165,7 +165,7 @@ class ChunkSection implements \pocketmine\level\format\ChunkSection{ return $column; } - public function &getBlockDataColumn($x, $z){ + public function getBlockDataColumn($x, $z){ $i = ($z << 3) + ($x >> 1); $column = ""; if(($x & 1) === 0){ @@ -181,7 +181,7 @@ class ChunkSection implements \pocketmine\level\format\ChunkSection{ return $column; } - public function &getBlockSkyLightColumn($x, $z){ + public function getBlockSkyLightColumn($x, $z){ $i = ($z << 3) + ($x >> 1); $column = ""; if(($x & 1) === 0){ @@ -197,7 +197,7 @@ class ChunkSection implements \pocketmine\level\format\ChunkSection{ return $column; } - public function &getBlockLightColumn($x, $z){ + public function getBlockLightColumn($x, $z){ $i = ($z << 3) + ($x >> 1); $column = ""; if(($x & 1) === 0){ @@ -213,19 +213,19 @@ class ChunkSection implements \pocketmine\level\format\ChunkSection{ return $column; } - public function &getIdArray(){ + public function getIdArray(){ return $this->blocks; } - public function &getDataArray(){ + public function getDataArray(){ return $this->data; } - public function &getSkyLightArray(){ + public function getSkyLightArray(){ return $this->skyLight; } - public function &getLightArray(){ + public function getLightArray(){ return $this->blockLight; } diff --git a/src/pocketmine/level/format/generic/BaseChunk.php b/src/pocketmine/level/format/generic/BaseChunk.php index 5fddaa50f..74be57f9b 100644 --- a/src/pocketmine/level/format/generic/BaseChunk.php +++ b/src/pocketmine/level/format/generic/BaseChunk.php @@ -165,7 +165,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{ } } - public function &getBlockIdColumn($x, $z){ + public function getBlockIdColumn($x, $z){ $column = ""; for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){ $column .= $this->sections[$y]->getBlockIdColumn($x, $z); @@ -174,7 +174,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{ return $column; } - public function &getBlockDataColumn($x, $z){ + public function getBlockDataColumn($x, $z){ $column = ""; for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){ $column .= $this->sections[$y]->getBlockDataColumn($x, $z); @@ -183,7 +183,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{ return $column; } - public function &getBlockSkyLightColumn($x, $z){ + public function getBlockSkyLightColumn($x, $z){ $column = ""; for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){ $column .= $this->sections[$y]->getBlockSkyLightColumn($x, $z); @@ -192,7 +192,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{ return $column; } - public function &getBlockLightColumn($x, $z){ + public function getBlockLightColumn($x, $z){ $column = ""; for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){ $column .= $this->sections[$y]->getBlockLightColumn($x, $z); @@ -227,7 +227,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{ return $this->getProvider() === null ? false : $this->getProvider()->getChunk($this->getX(), $this->getZ(), true) instanceof Chunk; } - public function &getBlockIdArray(){ + public function getBlockIdArray(){ $blocks = ""; for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){ $blocks .= $this->sections[$y]->getIdArray(); @@ -236,7 +236,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{ return $blocks; } - public function &getBlockDataArray(){ + public function getBlockDataArray(){ $data = ""; for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){ $data .= $this->sections[$y]->getDataArray(); @@ -245,7 +245,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{ return $data; } - public function &getBlockSkyLightArray(){ + public function getBlockSkyLightArray(){ $skyLight = ""; for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){ $skyLight .= $this->sections[$y]->getSkyLightArray(); @@ -254,7 +254,7 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{ return $skyLight; } - public function &getBlockLightArray(){ + public function getBlockLightArray(){ $blockLight = ""; for($y = 0; $y < Chunk::SECTION_COUNT; ++$y){ $blockLight .= $this->sections[$y]->getLightArray(); diff --git a/src/pocketmine/level/format/generic/BaseFullChunk.php b/src/pocketmine/level/format/generic/BaseFullChunk.php index 063749afd..0d20105c0 100644 --- a/src/pocketmine/level/format/generic/BaseFullChunk.php +++ b/src/pocketmine/level/format/generic/BaseFullChunk.php @@ -82,18 +82,18 @@ abstract class BaseFullChunk implements FullChunk{ * @param Compound[] $entities * @param Compound[] $tiles */ - protected function __construct($provider, $x, $z, &$blocks, &$data, &$skyLight, &$blockLight, &$biomeIds = null, array $biomeColors = [], array $heightMap = [], array $entities = [], array $tiles = []){ + protected function __construct($provider, $x, $z, $blocks, $data, $skyLight, $blockLight, $biomeIds = null, array $biomeColors = [], array $heightMap = [], array $entities = [], array $tiles = []){ $this->provider = $provider; $this->x = (int) $x; $this->z = (int) $z; - $this->blocks =& $blocks; - $this->data =& $data; - $this->skyLight =& $skyLight; - $this->blockLight =& $blockLight; + $this->blocks = $blocks; + $this->data = $data; + $this->skyLight = $skyLight; + $this->blockLight = $blockLight; if(strlen($biomeIds) === 256){ - $this->biomeIds =& $biomeIds; + $this->biomeIds = $biomeIds; }else{ $this->biomeIds = str_repeat("\x01", 256); } @@ -321,31 +321,31 @@ abstract class BaseFullChunk implements FullChunk{ return true; } - public function &getBlockIdArray(){ + public function getBlockIdArray(){ return $this->blocks; } - public function &getBlockDataArray(){ + public function getBlockDataArray(){ return $this->data; } - public function &getBlockSkyLightArray(){ + public function getBlockSkyLightArray(){ return $this->skyLight; } - public function &getBlockLightArray(){ + public function getBlockLightArray(){ return $this->blockLight; } - public function &getBiomeIdArray(){ + public function getBiomeIdArray(){ return $this->biomeIds; } - public function &getBiomeColorArray(){ + public function getBiomeColorArray(){ return $this->biomeColors; } - public function &getHeightMapArray(){ + public function getHeightMapArray(){ return $this->heightMap; } @@ -357,11 +357,11 @@ abstract class BaseFullChunk implements FullChunk{ $this->hasChanged = (bool) $changed; } - public static function fromFastBinary(&$data, LevelProvider $provider = null){ + public static function fromFastBinary($data, LevelProvider $provider = null){ return static::fromBinary($data, $provider); } - public function &toFastBinary(){ + public function toFastBinary(){ return $this->toBinary(); } diff --git a/src/pocketmine/level/format/leveldb/Chunk.php b/src/pocketmine/level/format/leveldb/Chunk.php index 921501ebc..be853c73b 100644 --- a/src/pocketmine/level/format/leveldb/Chunk.php +++ b/src/pocketmine/level/format/leveldb/Chunk.php @@ -32,7 +32,7 @@ class Chunk extends BaseFullChunk{ protected $isPopulated = false; protected $isGenerated = false; - public function __construct($level, $chunkX, $chunkZ, &$terrain, array $entityData = null, array $tileData = null){ + public function __construct($level, $chunkX, $chunkZ, $terrain, array $entityData = null, array $tileData = null){ $heightMap = array_fill(0, 256, 127); $offset = 0; @@ -221,7 +221,7 @@ class Chunk extends BaseFullChunk{ $this->isGenerated = (bool) $value; } - public static function fromFastBinary(&$data, LevelProvider $provider = null){ + public static function fromFastBinary($data, LevelProvider $provider = null){ return self::fromBinary($data, $provider); } @@ -231,7 +231,7 @@ class Chunk extends BaseFullChunk{ * * @return Chunk */ - public static function fromBinary(&$data, LevelProvider $provider = null){ + public static function fromBinary($data, LevelProvider $provider = null){ try{ $chunkX = Binary::readLInt(substr($data, 0, 4)); $chunkZ = Binary::readLInt(substr($data, 4, 4)); diff --git a/src/pocketmine/level/format/mcregion/Chunk.php b/src/pocketmine/level/format/mcregion/Chunk.php index 2b83aee7c..db454464c 100644 --- a/src/pocketmine/level/format/mcregion/Chunk.php +++ b/src/pocketmine/level/format/mcregion/Chunk.php @@ -276,7 +276,7 @@ class Chunk extends BaseFullChunk{ * * @return Chunk */ - public static function fromBinary(&$data, LevelProvider $provider = null){ + public static function fromBinary($data, LevelProvider $provider = null){ $nbt = new NBT(NBT::BIG_ENDIAN); try{ @@ -293,7 +293,7 @@ class Chunk extends BaseFullChunk{ } } - public static function fromFastBinary(&$data, LevelProvider $provider = null){ + public static function fromFastBinary($data, LevelProvider $provider = null){ try{ $offset = 0; @@ -340,7 +340,7 @@ class Chunk extends BaseFullChunk{ } } - public function &toFastBinary(){ + public function toFastBinary(){ $biomeColors = pack("N*", ...$this->getBiomeColorArray()); $heightMap = pack("N*", ...$this->getHeightMapArray()); @@ -358,7 +358,7 @@ class Chunk extends BaseFullChunk{ return $data; } - public function &toBinary(){ + public function toBinary(){ $nbt = clone $this->getNBT(); $nbt->xPos = new Int("xPos", $this->x); @@ -401,8 +401,7 @@ class Chunk extends BaseFullChunk{ $nbt->setName("Level"); $writer->setData(new Compound("", ["Level" => $nbt])); - $data =& $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL); - return $data; + return $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL); } /** diff --git a/src/pocketmine/level/format/mcregion/RegionLoader.php b/src/pocketmine/level/format/mcregion/RegionLoader.php index 1bc30e918..5fbe1c575 100644 --- a/src/pocketmine/level/format/mcregion/RegionLoader.php +++ b/src/pocketmine/level/format/mcregion/RegionLoader.php @@ -185,7 +185,7 @@ class RegionLoader{ } } - protected function saveChunk($x, $z, &$chunkData){ + protected function saveChunk($x, $z, $chunkData){ $length = strlen($chunkData) + 1; if($length + 4 > self::MAX_SECTOR_LENGTH){ throw new ChunkException("Chunk is too big! ".($length + 4)." > ".self::MAX_SECTOR_LENGTH); @@ -212,7 +212,7 @@ class RegionLoader{ public function writeChunk(FullChunk $chunk){ $this->lastUsed = time(); - $chunkData = &$chunk->toBinary(); + $chunkData = $chunk->toBinary(); if($chunkData !== false){ $this->saveChunk($chunk->getX() - ($this->getX() * 32), $chunk->getZ() - ($this->getZ() * 32), $chunkData); } diff --git a/src/pocketmine/nbt/NBT.php b/src/pocketmine/nbt/NBT.php index a287f36b4..8a0b5ccee 100644 --- a/src/pocketmine/nbt/NBT.php +++ b/src/pocketmine/nbt/NBT.php @@ -84,7 +84,7 @@ class NBT{ return $len === 1 ? $this->buffer{$this->offset++} : substr($this->buffer, ($this->offset += $len) - $len, $len); } - public function put(&$v){ + public function put($v){ $this->buffer .= $v; } @@ -99,7 +99,7 @@ class NBT{ public function read($buffer, $doMultiple = false){ $this->offset = 0; - $this->buffer =& $buffer; + $this->buffer = $buffer; $this->data = $this->readTag(); if($doMultiple and $this->offset < strlen($this->buffer)){ $this->data = [$this->data]; @@ -117,24 +117,24 @@ class NBT{ /** * @return string|bool */ - public function &write(){ + public function write(){ $this->offset = 0; $data = false; if($this->data instanceof Compound){ $this->writeTag($this->data); - $data =& $this->buffer; + $data = $this->buffer; }elseif(is_array($this->data)){ foreach($this->data as $tag){ $this->writeTag($tag); } - $data =& $this->buffer; + $data = $this->buffer; } return $data; } - public function &writeCompressed($compression = ZLIB_ENCODING_GZIP, $level = 7){ + public function writeCompressed($compression = ZLIB_ENCODING_GZIP, $level = 7){ $data = false; if(($write = $this->write()) !== false){ $data = zlib_encode($write, $compression, $level); @@ -258,7 +258,7 @@ class NBT{ return $this->get($this->getShort()); } - public function putString(&$v){ + public function putString($v){ $this->putShort(strlen($v)); $this->buffer .= $v; } diff --git a/src/pocketmine/nbt/tag/ByteArray.php b/src/pocketmine/nbt/tag/ByteArray.php index f83f4b735..5f80e1452 100644 --- a/src/pocketmine/nbt/tag/ByteArray.php +++ b/src/pocketmine/nbt/tag/ByteArray.php @@ -27,13 +27,6 @@ use pocketmine\nbt\NBT; class ByteArray extends NamedTag{ - public function __construct($name = "", &$value = null){ - $this->name = $name; - if($value !== null){ - $this->value =& $value; - } - } - public function getType(){ return NBT::TAG_ByteArray; } diff --git a/src/pocketmine/nbt/tag/NamedTag.php b/src/pocketmine/nbt/tag/NamedTag.php index 6ab3d4b81..12d7d537d 100644 --- a/src/pocketmine/nbt/tag/NamedTag.php +++ b/src/pocketmine/nbt/tag/NamedTag.php @@ -37,7 +37,7 @@ abstract class NamedTag extends Tag{ } } - public function &getName(){ + public function getName(){ return $this->name; } diff --git a/src/pocketmine/nbt/tag/String.php b/src/pocketmine/nbt/tag/String.php index 1f0bde0da..a23594b74 100644 --- a/src/pocketmine/nbt/tag/String.php +++ b/src/pocketmine/nbt/tag/String.php @@ -30,7 +30,7 @@ class String extends NamedTag{ public function __construct($name = "", $value = null){ $this->name = $name; if($value !== null){ - $this->value =& $value; + $this->value = $value; } } diff --git a/src/pocketmine/network/CompressBatchedTask.php b/src/pocketmine/network/CompressBatchedTask.php index 0048dedbe..22a4aaa90 100644 --- a/src/pocketmine/network/CompressBatchedTask.php +++ b/src/pocketmine/network/CompressBatchedTask.php @@ -32,7 +32,7 @@ class CompressBatchedTask extends AsyncTask{ public $channel = 0; public $targets = []; - public function __construct(&$data, array $targets, $level = 7, $channel = 0){ + public function __construct($data, array $targets, $level = 7, $channel = 0){ $this->data = $data; $this->targets = $targets; $this->level = $level; diff --git a/src/pocketmine/network/RakLibInterface.php b/src/pocketmine/network/RakLibInterface.php index ad2bd9b2f..59d94d3ba 100644 --- a/src/pocketmine/network/RakLibInterface.php +++ b/src/pocketmine/network/RakLibInterface.php @@ -248,7 +248,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{ return null; } - private function getPacket(&$buffer){ + private function getPacket($buffer){ $pid = ord($buffer{0}); if(($data = $this->network->getPacket($pid)) === null){ diff --git a/src/pocketmine/network/protocol/DataPacket.php b/src/pocketmine/network/protocol/DataPacket.php index 53571ab65..ff71f1c57 100644 --- a/src/pocketmine/network/protocol/DataPacket.php +++ b/src/pocketmine/network/protocol/DataPacket.php @@ -57,8 +57,8 @@ abstract class DataPacket extends \stdClass{ return $this->channel; } - public function setBuffer(&$buffer = null, $offset = 0){ - $this->buffer =& $buffer; + public function setBuffer($buffer = null, $offset = 0){ + $this->buffer = $buffer; $this->offset = (int) $offset; } @@ -66,7 +66,7 @@ abstract class DataPacket extends \stdClass{ return $this->offset; } - public function &getBuffer(){ + public function getBuffer(){ return $this->buffer; } @@ -81,7 +81,7 @@ abstract class DataPacket extends \stdClass{ return $len === 1 ? $this->buffer{$this->offset++} : substr($this->buffer, ($this->offset += $len) - $len, $len); } - protected function put(&$str){ + protected function put($str){ $this->buffer .= $str; } @@ -179,7 +179,7 @@ abstract class DataPacket extends \stdClass{ return $this->get($this->getShort()); } - protected function putString(&$v){ + protected function putString($v){ $this->putShort(strlen($v)); $this->put($v); } diff --git a/src/raklib b/src/raklib index 424faed1d..caa379e57 160000 --- a/src/raklib +++ b/src/raklib @@ -1 +1 @@ -Subproject commit 424faed1dc78564222301a56811bd6394b6c74a0 +Subproject commit caa379e570dca9382d9619843ef93d753267cafa diff --git a/src/spl b/src/spl index 3db41e126..c6763e38d 160000 --- a/src/spl +++ b/src/spl @@ -1 +1 @@ -Subproject commit 3db41e1266811b20c3f52f749265f6c9d416c1bb +Subproject commit c6763e38dc3da4db13bea176e05564c04cfb5e98