mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 19:55:33 +00:00
Merge branch 'stable'
# Conflicts: # resources/vanilla # src/pocketmine/Player.php
This commit is contained in:
commit
e6a3f7baa2
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\convert;
|
||||
|
||||
use pocketmine\entity\InvalidSkinException;
|
||||
use pocketmine\entity\Skin;
|
||||
|
||||
use pocketmine\network\mcpe\protocol\types\SkinData;
|
||||
@ -58,12 +59,11 @@ class LegacySkinAdapter implements SkinAdapter{
|
||||
|
||||
$capeData = $data->isPersonaCapeOnClassic() ? "" : $data->getCapeImage()->getData();
|
||||
|
||||
$geometryName = "";
|
||||
$resourcePatch = json_decode($data->getResourcePatch(), true);
|
||||
if(isset($resourcePatch["geometry"]["default"]) && is_string($resourcePatch["geometry"]["default"])){
|
||||
$geometryName = $resourcePatch["geometry"]["default"];
|
||||
}else{
|
||||
//TODO: Kick for invalid skin
|
||||
throw new InvalidSkinException("Missing geometry name field");
|
||||
}
|
||||
|
||||
return new Skin($data->getSkinId(), $data->getSkinImage()->getData(), $capeData, $geometryName, $data->getGeometryData());
|
||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\convert;
|
||||
|
||||
use pocketmine\entity\InvalidSkinException;
|
||||
use pocketmine\entity\Skin;
|
||||
use pocketmine\network\mcpe\protocol\types\SkinData;
|
||||
|
||||
@ -38,6 +39,7 @@ interface SkinAdapter{
|
||||
|
||||
/**
|
||||
* Allows you to convert skin data to a skin entity.
|
||||
* @throws InvalidSkinException
|
||||
*/
|
||||
public function fromSkinData(SkinData $data) : Skin;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace pocketmine\network\mcpe\handler;
|
||||
|
||||
use Mdanter\Ecc\Crypto\Key\PublicKeyInterface;
|
||||
use pocketmine\entity\InvalidSkinException;
|
||||
use pocketmine\event\player\PlayerPreLoginEvent;
|
||||
use pocketmine\network\BadPacketException;
|
||||
use pocketmine\network\mcpe\auth\ProcessLoginTask;
|
||||
@ -112,7 +113,7 @@ class LoginPacketHandler extends PacketHandler{
|
||||
$clientData = $this->parseClientData($packet->clientDataJwt);
|
||||
try{
|
||||
$skin = SkinAdapterSingleton::get()->fromSkinData(ClientDataToSkinDataHelper::getInstance()->fromClientData($clientData));
|
||||
}catch(\InvalidArgumentException $e){
|
||||
}catch(\InvalidArgumentException | InvalidSkinException $e){
|
||||
$this->session->getLogger()->debug("Invalid skin: " . $e->getMessage());
|
||||
$this->session->disconnect("disconnectionScreen.invalidSkin");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user