public function onClose(Player $who)
{
if ($this->getHolder()->getLevel() instanceof Level) {
/** @var TrappedChest $block */
$block = $this->getHolder()->getBlock();
if ($block instanceof TrappedChest) {
if ($block->isActivated()) {
$block->deactivate();
}
}
}
if (count($this->getViewers()) === 1) {
$pk = new BlockEventPacket();
$pk->x = $this->getHolder()->getX();
$pk->y = $this->getHolder()->getY();
$pk->z = $this->getHolder()->getZ();
$pk->case1 = 1;
$pk->case2 = 0;
if (($level = $this->getHolder()->getLevel()) instanceof Level) {
$level->addChunkPacket($this->getHolder()->getX() >> 4, $this->getHolder()->getZ() >> 4, $pk);
}
}
parent::onClose($who);
}