diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 55072d40c..086150fbc 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -2199,9 +2199,6 @@ class Server{ $pk = new PlayerListPacket(); $pk->type = PlayerListPacket::TYPE_ADD; foreach($this->playerList as $player){ - if($p === $player){ - continue; //fixes duplicates - } $pk->entries[] = [$player->getUniqueId(), $player->getId(), $player->getDisplayName(), $player->getSkinId(), $player->getSkinData()]; } diff --git a/src/pocketmine/utils/BinaryStream.php b/src/pocketmine/utils/BinaryStream.php index 156ce4523..5fc671f4b 100644 --- a/src/pocketmine/utils/BinaryStream.php +++ b/src/pocketmine/utils/BinaryStream.php @@ -177,11 +177,19 @@ class BinaryStream extends \stdClass{ } public function getUUID(){ - return UUID::fromBinary($this->get(16)); + //This is actually two little-endian longs: UUID Most followed by UUID Least + $part1 = $this->getLInt(); + $part0 = $this->getLInt(); + $part3 = $this->getLInt(); + $part2 = $this->getLInt(); + return new UUID($part0, $part1, $part2, $part3); } public function putUUID(UUID $uuid){ - $this->put($uuid->toBinary()); + $this->putLInt($uuid->getPart(1)); + $this->putLInt($uuid->getPart(0)); + $this->putLInt($uuid->getPart(3)); + $this->putLInt($uuid->getPart(2)); } public function getSlot(){ diff --git a/src/pocketmine/utils/UUID.php b/src/pocketmine/utils/UUID.php index 552ea3376..3b6118257 100644 --- a/src/pocketmine/utils/UUID.php +++ b/src/pocketmine/utils/UUID.php @@ -102,4 +102,15 @@ class UUID{ public function __toString(){ return $this->toString(); } + + public function getPart(int $partNumber){ + if($partNumber < 0 or $partNumber > 3){ + throw new \InvalidArgumentException("Invalid UUID part index $partNumber"); + } + return $this->parts[$partNumber]; + } + + public function getParts() : array{ + return $this->parts; + } } \ No newline at end of file