mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
Exposed LoginPacket chain data to allow plugins to access this data
This commit is contained in:
parent
aa6eef26e9
commit
3e141afe48
@ -44,6 +44,11 @@ class LoginPacket extends DataPacket{
|
|||||||
public $skinId;
|
public $skinId;
|
||||||
public $skin = "";
|
public $skin = "";
|
||||||
|
|
||||||
|
/** @var array (the "chain" index contains one or more JWTs) */
|
||||||
|
public $chainData = [];
|
||||||
|
/** @var string */
|
||||||
|
public $clientDataJwt;
|
||||||
|
/** @var array decoded payload of the clientData JWT */
|
||||||
public $clientData = [];
|
public $clientData = [];
|
||||||
|
|
||||||
public function canBeSentBeforeLogin() : bool{
|
public function canBeSentBeforeLogin() : bool{
|
||||||
@ -62,8 +67,8 @@ class LoginPacket extends DataPacket{
|
|||||||
|
|
||||||
$this->setBuffer($this->getString(), 0);
|
$this->setBuffer($this->getString(), 0);
|
||||||
|
|
||||||
$chainData = json_decode($this->get($this->getLInt()));
|
$this->chainData = json_decode($this->get($this->getLInt()), true);
|
||||||
foreach($chainData->{"chain"} as $chain){
|
foreach($this->chainData["chain"] as $chain){
|
||||||
$webtoken = $this->decodeToken($chain);
|
$webtoken = $this->decodeToken($chain);
|
||||||
if(isset($webtoken["extraData"])){
|
if(isset($webtoken["extraData"])){
|
||||||
if(isset($webtoken["extraData"]["displayName"])){
|
if(isset($webtoken["extraData"]["displayName"])){
|
||||||
@ -78,7 +83,8 @@ class LoginPacket extends DataPacket{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->clientData = $this->decodeToken($this->get($this->getLInt()));
|
$this->clientDataJwt = $this->get($this->getLInt());
|
||||||
|
$this->clientData = $this->decodeToken($this->clientDataJwt);
|
||||||
|
|
||||||
$this->clientId = $this->clientData["ClientRandomId"] ?? null;
|
$this->clientId = $this->clientData["ClientRandomId"] ?? null;
|
||||||
$this->serverAddress = $this->clientData["ServerAddress"] ?? null;
|
$this->serverAddress = $this->clientData["ServerAddress"] ?? null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user