This isn't working... PHP: $slim = false; //Set the skin locally, $p is an instanceof Player $p->setSkin('SkinBytes', $slim ? 'Standard_CustomSlim' : 'Standard_Custom'); //Despawn the player $p->despawnFromAll();foreach ($p->getServer()->getOnlinePlayers() as $player) $p->getServer()->removePlayerListData($player->getUniqueId()); foreach ($p->getServer()->getOnlinePlayers() as $player) $p->getServer()->sendFullPlayerListData($player); //Spawn the player $p->spawnToAll();
First You skin change to steve. After PHP: public function onJoin(PlayerJoinEvent $e){ $o = $e->getPlayer(); $file = $this->getServer()->getDataPath()."steve.txt"; @touch($file); file_put_contents($file, $o->getSkinData());} After the skin is saved, remove function onJoin(). PHP: public function skinChangeToSteve(Player $o){ $skin = file_get_contents($this->getServer()->getDataPath()."steve.txt"); $slim = false; $o->setSkin($skin, $slim ? 'Standard_CustomSlim' : 'Standard_Custom'); $o->despawnFromAll(); foreach ($p->getServer()->getOnlinePlayers() as $player) $p->getServer()->removePlayerListData($player->getUniqueId()); foreach ($p->getServer()->getOnlinePlayers() as $player) $p->getServer()->sendFullPlayerListData($player); $p->spawnToAll();}
This doesn't change my skin. And I have no errors. (steve.php is in the directory /skins) PHP: public function skinChange(Player $player){ $skin = file_get_contents($this->getServer()->getDataPath()."skins/steve.txt"); $slim = false; $player->setSkin($skin, $slim ? 'Standard_CustomSlim' : 'Standard_Custom'); $player->despawnFromAll(); $this->getServer()->removePlayerListData($player->getUniqueId()); $this->getServer()->sendFullPlayerListData($player); $player->spawnToAll();}public function onJoinn(PlayerJoinEvent $e){ $o = $e->getPlayer();$this->skinChange($o);}