getViewers()); } /** * @return Player[] * @phpstan-return array */ abstract public function getViewers() : array; abstract protected function getOpenSound() : Sound; abstract protected function getCloseSound() : Sound; public function onOpen(Player $who) : void{ parent::onOpen($who); if($this->holder->isValid() && $this->getViewerCount() === 1){ //TODO: this crap really shouldn't be managed by the inventory $this->animateBlock(true); $this->holder->getWorld()->addSound($this->holder->center(), $this->getOpenSound()); } } abstract protected function animateBlock(bool $isOpen) : void; public function onClose(Player $who) : void{ if($this->holder->isValid() && $this->getViewerCount() === 1){ //TODO: this crap really shouldn't be managed by the inventory $this->animateBlock(false); $this->holder->getWorld()->addSound($this->holder->center(), $this->getCloseSound()); } parent::onClose($who); } }