public function mon_onTeleport(EntityTeleportEvent $event) { if ($this->disableTpListener or !$this->authenticated) { return; } if ($event->getFrom()->getLevel()->getName() !== $event->getTo()->getLevel()->getName()) { $this->tell("After finishing your current job, please go back to hub. You have quitted all games due to world teleportation."); $game = $this->main->getGame($this->session); if ($game instanceof Game) { $game->onQuit($this, true); $this->unsubscribeFromChannel($game->getDefaultChatChannel()); } $this->session = self::SESSION_GAME_HUB; } else { $from = Settings::checkInvisibility($event->getFrom()); $to = Settings::checkInvisibility($event->getTo()); if ($from and !$to) { $this->setVisible(self::INVISIBLE_SPAWN); } elseif (!$from and $to) { $this->setInvisible(self::INVISIBLE_SPAWN); } } }