mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 10:49:10 +00:00
Updated for .13.1. skinName replaces isSlim, API bump
This commit is contained in:
parent
2ddc4455c5
commit
90c3e66e6b
@ -571,14 +571,14 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
public function setDisplayName($name){
|
public function setDisplayName($name){
|
||||||
$this->displayName = $name;
|
$this->displayName = $name;
|
||||||
if($this->spawned){
|
if($this->spawned){
|
||||||
$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $this->isSkinSlim(), $this->getSkinData());
|
$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $this->getSkinName(), $this->getSkinData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSkin($str, $isSlim = false){
|
public function setSkin($str, $skinName){
|
||||||
parent::setSkin($str, $isSlim);
|
parent::setSkin($str, $skinName);
|
||||||
if($this->spawned){
|
if($this->spawned){
|
||||||
$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $isSlim, $str);
|
$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $skinName, $str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1856,7 +1856,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setSkin($packet->skin, $packet->slim);
|
$this->setSkin($packet->skin, $packet->skinName);
|
||||||
|
|
||||||
$this->server->getPluginManager()->callEvent($ev = new PlayerPreLoginEvent($this, "Plugin reason"));
|
$this->server->getPluginManager()->callEvent($ev = new PlayerPreLoginEvent($this, "Plugin reason"));
|
||||||
if($ev->isCancelled()){
|
if($ev->isCancelled()){
|
||||||
|
@ -73,10 +73,10 @@ namespace pocketmine {
|
|||||||
use pocketmine\wizard\Installer;
|
use pocketmine\wizard\Installer;
|
||||||
|
|
||||||
const VERSION = "1.6dev";
|
const VERSION = "1.6dev";
|
||||||
const API_VERSION = "1.13.0";
|
const API_VERSION = "1.13.1";
|
||||||
const CODENAME = "[REDACTED]";
|
const CODENAME = "[REDACTED]";
|
||||||
const MINECRAFT_VERSION = "v0.13.0 alpha";
|
const MINECRAFT_VERSION = "v0.13.1 alpha";
|
||||||
const MINECRAFT_VERSION_NETWORK = "0.13.0";
|
const MINECRAFT_VERSION_NETWORK = "0.13.1";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Startup code. Do not look at it, it may harm you.
|
* Startup code. Do not look at it, it may harm you.
|
||||||
|
@ -2248,7 +2248,7 @@ class Server{
|
|||||||
public function addOnlinePlayer(Player $player){
|
public function addOnlinePlayer(Player $player){
|
||||||
$this->playerList[$player->getRawUniqueId()] = $player;
|
$this->playerList[$player->getRawUniqueId()] = $player;
|
||||||
|
|
||||||
$this->updatePlayerListData($player->getUniqueId(), $player->getId(), $player->getDisplayName(), $player->isSkinSlim(), $player->getSkinData());
|
$this->updatePlayerListData($player->getUniqueId(), $player->getId(), $player->getDisplayName(), $player->getSkinName(), $player->getSkinData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeOnlinePlayer(Player $player){
|
public function removeOnlinePlayer(Player $player){
|
||||||
@ -2262,10 +2262,10 @@ class Server{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updatePlayerListData(UUID $uuid, $entityId, $name, $isSlim, $skinData, array $players = null){
|
public function updatePlayerListData(UUID $uuid, $entityId, $name, $skinName, $skinData, array $players = null){
|
||||||
$pk = new PlayerListPacket();
|
$pk = new PlayerListPacket();
|
||||||
$pk->type = PlayerListPacket::TYPE_ADD;
|
$pk->type = PlayerListPacket::TYPE_ADD;
|
||||||
$pk->entries[] = [$uuid, $entityId, $name, $isSlim, $skinData];
|
$pk->entries[] = [$uuid, $entityId, $name, $skinName, $skinData];
|
||||||
Server::broadcastPacket($players === null ? $this->playerList : $players, $pk);
|
Server::broadcastPacket($players === null ? $this->playerList : $players, $pk);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2280,7 +2280,7 @@ class Server{
|
|||||||
$pk = new PlayerListPacket();
|
$pk = new PlayerListPacket();
|
||||||
$pk->type = PlayerListPacket::TYPE_ADD;
|
$pk->type = PlayerListPacket::TYPE_ADD;
|
||||||
foreach($this->playerList as $player){
|
foreach($this->playerList as $player){
|
||||||
$pk->entries[] = [$player->getUniqueId(), $player->getId(), $player->getDisplayName(), $player->isSkinSlim(), $player->getSkinData()];
|
$pk->entries[] = [$player->getUniqueId(), $player->getId(), $player->getDisplayName(), $player->getSkinName(), $player->getSkinData()];
|
||||||
}
|
}
|
||||||
|
|
||||||
$p->dataPacket($pk);
|
$p->dataPacket($pk);
|
||||||
|
@ -57,15 +57,15 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
public $height = 1.8;
|
public $height = 1.8;
|
||||||
public $eyeHeight = 1.62;
|
public $eyeHeight = 1.62;
|
||||||
|
|
||||||
|
protected $skinName;
|
||||||
protected $skin;
|
protected $skin;
|
||||||
protected $isSlim = false;
|
|
||||||
|
|
||||||
public function getSkinData(){
|
public function getSkinData(){
|
||||||
return $this->skin;
|
return $this->skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isSkinSlim(){
|
public function getSkinName(){
|
||||||
return $this->isSlim;
|
return $this->skinName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,11 +84,11 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $str
|
* @param string $str
|
||||||
* @param bool $isSlim
|
* @param string $skinName
|
||||||
*/
|
*/
|
||||||
public function setSkin($str, $isSlim = false){
|
public function setSkin($str, $skinName){
|
||||||
$this->skin = $str;
|
$this->skin = $str;
|
||||||
$this->isSlim = (bool) $isSlim;
|
$this->skinName = $skinName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInventory(){
|
public function getInventory(){
|
||||||
@ -112,7 +112,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isset($this->namedtag->Skin) and $this->namedtag->Skin instanceof Compound){
|
if(isset($this->namedtag->Skin) and $this->namedtag->Skin instanceof Compound){
|
||||||
$this->setSkin($this->namedtag->Skin["Data"], $this->namedtag->Skin["Slim"] > 0);
|
$this->setSkin($this->namedtag->Skin["Data"], $this->namedtag->Skin["Name"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->uuid = UUID::fromData($this->getId(), $this->getSkinData(), $this->getNameTag());
|
$this->uuid = UUID::fromData($this->getId(), $this->getSkinData(), $this->getNameTag());
|
||||||
@ -195,7 +195,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
if(strlen($this->getSkinData()) > 0){
|
if(strlen($this->getSkinData()) > 0){
|
||||||
$this->namedtag->Skin = new Compound("Skin", [
|
$this->namedtag->Skin = new Compound("Skin", [
|
||||||
"Data" => new String("Data", $this->getSkinData()),
|
"Data" => new String("Data", $this->getSkinData()),
|
||||||
"Slim" => new Byte("Slim", $this->isSkinSlim() ? 1 : 0)
|
"Name" => new String("Name", $this->getSkinName())
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
|||||||
|
|
||||||
|
|
||||||
if(!($this instanceof Player)){
|
if(!($this instanceof Player)){
|
||||||
$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getName(), $this->isSlim, $this->skin, [$player]);
|
$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getName(), $this->skinName, $this->skin, [$player]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pk = new AddPlayerPacket();
|
$pk = new AddPlayerPacket();
|
||||||
|
@ -36,7 +36,7 @@ class LoginPacket extends DataPacket{
|
|||||||
public $serverAddress;
|
public $serverAddress;
|
||||||
public $clientSecret;
|
public $clientSecret;
|
||||||
|
|
||||||
public $slim = false;
|
public $skinName;
|
||||||
public $skin = null;
|
public $skin = null;
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
@ -52,8 +52,7 @@ class LoginPacket extends DataPacket{
|
|||||||
$this->serverAddress = $this->getString();
|
$this->serverAddress = $this->getString();
|
||||||
$this->clientSecret = $this->getString();
|
$this->clientSecret = $this->getString();
|
||||||
|
|
||||||
$this->slim = $this->getByte() > 0;
|
$this->skinName = $this->getString();
|
||||||
$this->getByte(); // TODO: skin transparency, experimental or not?
|
|
||||||
$this->skin = $this->getString();
|
$this->skin = $this->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,8 +53,7 @@ class PlayerListPacket extends DataPacket{
|
|||||||
$this->putUUID($d[0]);
|
$this->putUUID($d[0]);
|
||||||
$this->putLong($d[1]);
|
$this->putLong($d[1]);
|
||||||
$this->putString($d[2]);
|
$this->putString($d[2]);
|
||||||
$this->putByte($d[3] ? 1 : 0);
|
$this->putString($d[3]);
|
||||||
$this->putByte(0); // TODO: skin transparency, experimental or not?
|
|
||||||
$this->putString($d[4]);
|
$this->putString($d[4]);
|
||||||
}else{
|
}else{
|
||||||
$this->putUUID($d[0]);
|
$this->putUUID($d[0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user