Merge branch 'api3/network' into api3/network_mcpe-1.0.5

This commit is contained in:
Dylan K. Taylor
2017-03-25 21:31:48 +00:00
18 changed files with 161 additions and 94 deletions

View File

@ -112,7 +112,6 @@ use pocketmine\network\mcpe\protocol\AddPlayerPacket;
use pocketmine\network\mcpe\protocol\AdventureSettingsPacket;
use pocketmine\network\mcpe\protocol\AnimatePacket;
use pocketmine\network\mcpe\protocol\AvailableCommandsPacket;
use pocketmine\network\mcpe\protocol\BatchPacket;
use pocketmine\network\mcpe\protocol\BlockEntityDataPacket;
use pocketmine\network\mcpe\protocol\BlockEventPacket;
use pocketmine\network\mcpe\protocol\BlockPickRequestPacket;
@ -1955,11 +1954,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
return false;
}
public function handleBatch(BatchPacket $packet) : bool{
$this->server->getNetwork()->processBatch($packet, $this);
return true;
}
public function handleResourcePacksInfo(ResourcePacksInfoPacket $packet) : bool{
return false;
}
@ -2237,6 +2231,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$item = $this->inventory->getItem($packet->inventorySlot);
if(!$item->equals($packet->item)){
$this->server->getLogger()->debug("Tried to equip " . $packet->item . " but have " . $item . " in target slot");
$this->inventory->sendContents($this);
return false;
}
@ -3317,6 +3312,9 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$timings = Timings::getReceiveDataPacketTimings($packet);
$timings->startTiming();
$packet->decode();
assert($packet->feof(), "Still " . strlen(substr($packet->buffer, $packet->offset)) . " bytes unread in " . get_class($packet));
$this->server->getPluginManager()->callEvent($ev = new DataPacketReceiveEvent($this, $packet));
if(!$ev->isCancelled() and !$packet->handle($this)){
$this->server->getLogger()->debug("Unhandled " . get_class($packet) . " received from " . $this->getName());
@ -3580,6 +3578,13 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
return $this->username;
}
/**
* @return string
*/
public function getLowerCaseName() : string{
return $this->iusername;
}
public function kill(){
if(!$this->spawned){
return;