mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Fixed player list self-duplication
This commit is contained in:
parent
6d90f91be0
commit
f889bf9cf5
@ -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()];
|
||||
}
|
||||
|
||||
|
@ -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(){
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user