Drop pocketmine/uuid for ramsey/uuid

This commit is contained in:
Dylan K. Taylor
2021-03-16 23:03:00 +00:00
parent 6d622c4020
commit 72de45f0e9
24 changed files with 374 additions and 183 deletions

View File

@ -101,7 +101,6 @@ use pocketmine\permission\PermissibleDelegateTrait;
use pocketmine\Server;
use pocketmine\timings\Timings;
use pocketmine\utils\TextFormat;
use pocketmine\uuid\UUID;
use pocketmine\world\ChunkListener;
use pocketmine\world\ChunkListenerNoOpTrait;
use pocketmine\world\format\Chunk;
@ -110,6 +109,7 @@ use pocketmine\world\sound\EntityAttackNoDamageSound;
use pocketmine\world\sound\EntityAttackSound;
use pocketmine\world\sound\FireExtinguishSound;
use pocketmine\world\World;
use Ramsey\Uuid\UuidInterface;
use function abs;
use function assert;
use function count;
@ -397,7 +397,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
* as SimpleAuth for authentication. This is NOT SAFE anymore as this UUID is now what was given by the client, NOT
* a server-computed UUID.)
*/
public function getUniqueId() : UUID{
public function getUniqueId() : UuidInterface{
return parent::getUniqueId();
}
@ -471,14 +471,14 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
}
public function canSee(Player $player) : bool{
return !isset($this->hiddenPlayers[$player->getUniqueId()->toBinary()]);
return !isset($this->hiddenPlayers[$player->getUniqueId()->getBytes()]);
}
public function hidePlayer(Player $player) : void{
if($player === $this){
return;
}
$this->hiddenPlayers[$player->getUniqueId()->toBinary()] = true;
$this->hiddenPlayers[$player->getUniqueId()->getBytes()] = true;
$player->despawnFrom($this);
}
@ -486,7 +486,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
if($player === $this){
return;
}
unset($this->hiddenPlayers[$player->getUniqueId()->toBinary()]);
unset($this->hiddenPlayers[$player->getUniqueId()->getBytes()]);
if($player->isOnline()){
$player->spawnTo($this);
}

View File

@ -25,7 +25,7 @@ namespace pocketmine\player;
use pocketmine\entity\Skin;
use pocketmine\utils\TextFormat;
use pocketmine\uuid\UUID;
use Ramsey\Uuid\UuidInterface;
/**
* Encapsulates data needed to create a player.
@ -34,7 +34,7 @@ class PlayerInfo{
/** @var string */
private $username;
/** @var UUID */
/** @var UuidInterface */
private $uuid;
/** @var Skin */
private $skin;
@ -50,7 +50,7 @@ class PlayerInfo{
* @param mixed[] $extraData
* @phpstan-param array<string, mixed> $extraData
*/
public function __construct(string $username, UUID $uuid, Skin $skin, string $locale, array $extraData = []){
public function __construct(string $username, UuidInterface $uuid, Skin $skin, string $locale, array $extraData = []){
$this->username = TextFormat::clean($username);
$this->uuid = $uuid;
$this->skin = $skin;
@ -62,7 +62,7 @@ class PlayerInfo{
return $this->username;
}
public function getUuid() : UUID{
public function getUuid() : UuidInterface{
return $this->uuid;
}

View File

@ -24,7 +24,7 @@ declare(strict_types=1);
namespace pocketmine\player;
use pocketmine\entity\Skin;
use pocketmine\uuid\UUID;
use Ramsey\Uuid\UuidInterface;
/**
* Encapsulates player info specific to players who are authenticated with XBOX Live.
@ -34,7 +34,7 @@ final class XboxLivePlayerInfo extends PlayerInfo{
/** @var string */
private $xuid;
public function __construct(string $xuid, string $username, UUID $uuid, Skin $skin, string $locale, array $extraData = []){
public function __construct(string $xuid, string $username, UuidInterface $uuid, Skin $skin, string $locale, array $extraData = []){
parent::__construct($username, $uuid, $skin, $locale, $extraData);
$this->xuid = $xuid;
}