Example #1
0
 public function close()
 {
     if (!$this->closed) {
         $this->closed = true;
         unset($this->level->updateTiles[$this->id]);
         if ($this->chunk instanceof FullChunk) {
             $this->chunk->removeTile($this);
         }
         if (($level = $this->getLevel()) instanceof Level) {
             $level->removeTile($this);
         }
         $this->level = null;
     }
 }
Example #2
0
 public function close()
 {
     if (!$this->closed) {
         $this->server->getPluginManager()->callEvent(new EntityDespawnEvent($this));
         $this->closed = true;
         $this->despawnFromAll();
         if ($this->chunk !== null) {
             $this->chunk->removeEntity($this);
         }
         if ($this->level !== null) {
             $this->level->removeEntity($this);
         }
     }
 }