Getting ready, protocol changes!

This commit is contained in:
Shoghi Cervantes 2015-04-09 17:42:06 +02:00
parent f2e2cec024
commit b4a0afc2c8
2 changed files with 36 additions and 0 deletions

View File

@ -1843,6 +1843,40 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->startAction = -1;
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false);
break;
case ProtocolInfo::RESPAWN_PACKET:
//TODO: Remove
if($this->spawned === false or $this->dead === false){
break;
}
$this->craftingType = 0;
$this->server->getPluginManager()->callEvent($ev = new PlayerRespawnEvent($this, $this->getSpawn()));
$this->teleport($ev->getRespawnPosition());
$this->extinguish();
$this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, 300);
$this->deadTicks = 0;
$this->noDamageTicks = 60;
$this->setHealth(20);
$this->dead = false;
$this->removeAllEffects();
$this->sendData($this);
$this->sendSettings();
$this->inventory->sendContents($this);
$this->inventory->sendArmorContents($this);
$this->blocked = false;
$this->spawnToAll();
$this->scheduleUpdate();
break;
case ProtocolInfo::REMOVE_BLOCK_PACKET:
if($this->spawned === false or $this->blocked === true or $this->dead === true){
break;

View File

@ -37,6 +37,7 @@ class RespawnPacket extends DataPacket{
}
public function decode(){
$this->getLong(); //TODO: remove
$this->x = $this->getFloat();
$this->y = $this->getFloat();
$this->z = $this->getFloat();
@ -44,6 +45,7 @@ class RespawnPacket extends DataPacket{
public function encode(){
$this->reset();
$this->putLong(0); //TODO: remove
$this->putFloat($this->x);
$this->putFloat($this->y);
$this->putFloat($this->z);