mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 16:29:40 +00:00
InGamePacketHandler: handle InvalidSkinException thrown by SkinAdapter::fromSkinData()
This commit is contained in:
parent
05615b3eb7
commit
6f4d4be3da
@ -27,6 +27,7 @@ use pocketmine\block\ItemFrame;
|
|||||||
use pocketmine\block\Sign;
|
use pocketmine\block\Sign;
|
||||||
use pocketmine\block\utils\SignText;
|
use pocketmine\block\utils\SignText;
|
||||||
use pocketmine\entity\animation\ConsumingItemAnimation;
|
use pocketmine\entity\animation\ConsumingItemAnimation;
|
||||||
|
use pocketmine\entity\InvalidSkinException;
|
||||||
use pocketmine\event\player\PlayerEditBookEvent;
|
use pocketmine\event\player\PlayerEditBookEvent;
|
||||||
use pocketmine\inventory\transaction\action\InventoryAction;
|
use pocketmine\inventory\transaction\action\InventoryAction;
|
||||||
use pocketmine\inventory\transaction\CraftingTransaction;
|
use pocketmine\inventory\transaction\CraftingTransaction;
|
||||||
@ -634,7 +635,12 @@ class InGamePacketHandler extends PacketHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function handlePlayerSkin(PlayerSkinPacket $packet) : bool{
|
public function handlePlayerSkin(PlayerSkinPacket $packet) : bool{
|
||||||
return $this->player->changeSkin(SkinAdapterSingleton::get()->fromSkinData($packet->skin), $packet->newSkinName, $packet->oldSkinName);
|
try{
|
||||||
|
$skin = SkinAdapterSingleton::get()->fromSkinData($packet->skin);
|
||||||
|
}catch(InvalidSkinException $e){
|
||||||
|
throw BadPacketException::wrap($e, "Invalid skin in PlayerSkinPacket");
|
||||||
|
}
|
||||||
|
return $this->player->changeSkin($skin, $packet->newSkinName, $packet->oldSkinName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleSubClientLogin(SubClientLoginPacket $packet) : bool{
|
public function handleSubClientLogin(SubClientLoginPacket $packet) : bool{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user