Player: rewrite the confusing documentation of getUniqueId()

This commit is contained in:
Dylan K. Taylor 2021-07-22 21:14:31 +01:00
parent 59b8453228
commit 61528393c2
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -483,19 +483,15 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
}
/**
* Returns the player's UUID. This should be preferred over their Xbox user ID (XUID) because UUID is a standard
* format which will never change, and all players will have one regardless of whether they are logged into Xbox
* Live.
* Returns the player's UUID. This should be the preferred method to identify a player.
* It does not change if the player changes their username.
*
* The UUID is comprised of:
* - when logged into XBL: a hash of their XUID (and as such will not change for the lifetime of the XBL account)
* - when NOT logged into XBL: a hash of their name + clientID + secret device ID.
* All players will have a UUID, regardless of whether they are logged into Xbox Live or not. However, note that
* non-XBL players can fake their UUIDs.
*
* WARNING: UUIDs of players **not logged into Xbox Live** CAN BE FAKED and SHOULD NOT be trusted!
*
* (In the olden days this method used to return a fake UUID computed by the server, which was used by plugins such
* 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.)
* WARNING: DO NOT trust this before PlayerLoginEvent. Before PlayerLoginEvent, the player hasn't yet been
* authenticated, and any of their data might be faked. However, you can use it for things like checking bans at any
* time (since it doesn't make sense to impersonate a banned player anyway).
*/
public function getUniqueId() : ?UUID{
return parent::getUniqueId();