Improved network packets allocation

This commit is contained in:
Shoghi Cervantes
2014-10-27 20:30:33 +01:00
parent 3f5b129cf5
commit db82f76c11
69 changed files with 366 additions and 222 deletions

View File

@ -29,7 +29,7 @@ use pocketmine\Player;
abstract class ContainerInventory extends BaseInventory{
public function onOpen(Player $who){
parent::onOpen($who);
$pk = new ContainerOpenPacket;
$pk = ContainerOpenPacket::getFromPool();
$pk->windowid = $who->getWindowId($this);
$pk->type = $this->getType()->getNetworkType();
$pk->slots = $this->getSize();
@ -47,7 +47,7 @@ abstract class ContainerInventory extends BaseInventory{
}
public function onClose(Player $who){
$pk = new ContainerClosePacket;
$pk = ContainerClosePacket::getFromPool();
$pk->windowid = $who->getWindowId($this);
$who->dataPacket($pk);
parent::onClose($who);