mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
Added skin checks to Player and Human
This commit is contained in:
parent
0aa9586a52
commit
73d1d131e1
@ -1340,6 +1340,11 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$this->nameTag = $this->username;
|
$this->nameTag = $this->username;
|
||||||
$this->iusername = strtolower($this->username);
|
$this->iusername = strtolower($this->username);
|
||||||
$this->randomClientId = $packet->clientId;
|
$this->randomClientId = $packet->clientId;
|
||||||
|
if(strlen($packet->skin) < 64 * 32 * 4){
|
||||||
|
$this->close("", "Invalid skin", false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->setSkin($packet->skin, $packet->slim);
|
$this->setSkin($packet->skin, $packet->slim);
|
||||||
$this->loginData = ["clientId" => $packet->clientId, "loginData" => null];
|
$this->loginData = ["clientId" => $packet->clientId, "loginData" => null];
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ use pocketmine\Network;
|
|||||||
use pocketmine\network\protocol\AddPlayerPacket;
|
use pocketmine\network\protocol\AddPlayerPacket;
|
||||||
use pocketmine\network\protocol\RemovePlayerPacket;
|
use pocketmine\network\protocol\RemovePlayerPacket;
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
use pocketmine\utils\TextFormat;
|
|
||||||
|
|
||||||
class Human extends Creature implements ProjectileSource, InventoryHolder{
|
class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||||
|
|
||||||
@ -186,6 +185,10 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
if($player !== $this and !isset($this->hasSpawned[$player->getId()])){
|
if($player !== $this and !isset($this->hasSpawned[$player->getId()])){
|
||||||
$this->hasSpawned[$player->getId()] = $player;
|
$this->hasSpawned[$player->getId()] = $player;
|
||||||
|
|
||||||
|
if(strlen($this->skin) < 64 * 32 * 4){
|
||||||
|
throw new \InvalidStateException((new \ReflectionClass($this))->getShortName() . " must have a valid skin set");
|
||||||
|
}
|
||||||
|
|
||||||
$pk = new AddPlayerPacket();
|
$pk = new AddPlayerPacket();
|
||||||
$pk->clientID = 0;
|
$pk->clientID = 0;
|
||||||
$pk->username = $this->nameTag;
|
$pk->username = $this->nameTag;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user