mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
Server: added getPlayerByUUID() and getPlayerByRawUUID()
closes #2047 Since the player list already indexes players by UUID, it's simple to just use that for fetching the player. A possible future improvement could be to allow fetching an _offline_ player by UUID, but no capability to do that is yet available.
This commit is contained in:
parent
28e601bbb9
commit
5a89e80873
@ -878,6 +878,28 @@ class Server{
|
|||||||
return $matchedPlayers;
|
return $matchedPlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the player online with the specified raw UUID, or null if not found
|
||||||
|
*
|
||||||
|
* @param string $rawUUID
|
||||||
|
*
|
||||||
|
* @return null|Player
|
||||||
|
*/
|
||||||
|
public function getPlayerByRawUUID(string $rawUUID) : ?Player{
|
||||||
|
return $this->playerList[$rawUUID] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the player online with a UUID equivalent to the specified UUID object, or null if not found
|
||||||
|
*
|
||||||
|
* @param UUID $uuid
|
||||||
|
*
|
||||||
|
* @return null|Player
|
||||||
|
*/
|
||||||
|
public function getPlayerByUUID(UUID $uuid) : ?Player{
|
||||||
|
return $this->getPlayerByRawUUID($uuid->toBinary());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Level[]
|
* @return Level[]
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user