setSkin() public method

public setSkin ( string $str, string $skinId )
$str string
$skinId string
Example #1
0
 public function setSkin($str, $skinname = "", $isOldClient = false, $isSlim = false, $isTransparent = null)
 {
     parent::setSkin($str, $skinname, $isOldClient, $isSlim, $isTransparent);
     if ($this->spawned) {
         $this->server->sendFullPlayerListData($this);
     }
 }
Example #2
0
 public function setSkin($str, $isSlim = false)
 {
     parent::setSkin($str, $isSlim);
     if ($this->spawned === true) {
         $this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $isSlim, $str);
     }
 }
Example #3
0
 public function setSkin($str, $skinName)
 {
     parent::setSkin($str, $skinName);
     if ($this->spawned) {
         $this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $skinName, $str);
     }
 }
Example #4
0
 public function setSkin($str, $isSlim = false)
 {
     parent::setSkin($str, $isSlim);
     if ($this->spawned) {
         $this->respawnToAll();
     }
 }
Example #5
0
 public function setSkin($str, $isSlim = false, $skinTransparency = false)
 {
     parent::setSkin($str, $isSlim, $skinTransparency);
     if ($this->spawned) {
         $this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $isSlim, $str, null, $skinTransparency);
     }
 }
Example #6
0
 /**
  * Load skin
  * @param Human $human
  * @param bool $slim
  * @param str $fn
  * @return bool
  */
 public static function loadSkin(Human $human, $slim, $fn)
 {
     if (self::isPngExt($fn)) {
         if (!extension_loaded("gd")) {
             return false;
         }
         if (!self::isSkinFile($fn)) {
             return false;
         }
         $img = imagecreatefrompng($fn);
         if ($img === false) {
             return false;
         }
         $bytes = "";
         $x = $y = 0;
         while ($y < 32) {
             $rgb = imagecolorat($img, $x, $y);
             $r = $rgb >> 16 & 0xff;
             $g = $rgb >> 8 & 0xff;
             $b = $rgb & 0xff;
             $bytes .= chr($r) . chr($g) . chr($b) . chr(255);
             $x++;
             if ($x === 64) {
                 $x = 0;
                 $y++;
             }
         }
         imagedestroy($img);
         echo "BYTES=" . strlen($bytes) . "\n";
         //##DEBUG
         $human->setSkin($bytes, $slim);
         return true;
     }
     $bin = file_get_contents($fn);
     if ($bin === false) {
         return false;
     }
     $human->setSkin(zlib_decode($bin), $slim);
     return true;
 }
Example #7
0
 public function setSkin($str, $isSlim = false)
 {
     parent::setSkin($str, $isSlim);
     if ($this->spawned === true) {
         $this->despawnFromAll();
         $this->spawnToAll();
     }
 }
 /**
  * Converts a human's skin to slim(32x64) if $slim is true, if $slim is false it will convert to non-slim(64x64)
  * @param Human $human
  * @param bool $slim
  */
 public static function setSlim(Human $human, $slim = true)
 {
     $human->setSkin($human->getSkinData(), $slim);
 }
Example #9
0
 public function setSkin($str, $skinname)
 {
     parent::setSkin($str, $skinname);
     if ($this->spawned) {
         $this->server->sendFullPlayerListData($this);
     }
 }
Example #10
0
 public function setSkin($str, $isSlim = false, $isTransparent = false)
 {
     parent::setSkin($str, $isSlim, $isTransparent);
     if ($this->spawned) {
         $this->server->sendFullPlayerListData($this);
     }
 }