mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Improved network packets allocation
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user