mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 18:29:46 +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 $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 function canBeSentBeforeLogin() : bool{
|
||||
@ -62,8 +67,8 @@ class LoginPacket extends DataPacket{
|
||||
|
||||
$this->setBuffer($this->getString(), 0);
|
||||
|
||||
$chainData = json_decode($this->get($this->getLInt()));
|
||||
foreach($chainData->{"chain"} as $chain){
|
||||
$this->chainData = json_decode($this->get($this->getLInt()), true);
|
||||
foreach($this->chainData["chain"] as $chain){
|
||||
$webtoken = $this->decodeToken($chain);
|
||||
if(isset($webtoken["extraData"])){
|
||||
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->serverAddress = $this->clientData["ServerAddress"] ?? null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user