Example #1
0
 public function mon_onMove(PlayerMoveEvent $event)
 {
     $game = Settings::portal($this->getPlayer(), $this->main);
     if ($game instanceof Game) {
         $this->getPlayer()->getInventory()->clearAll();
         if ($game->onJoin($this)) {
             $this->tell("You have entered the game: %s", $game->getName());
             $this->switchSession($game->getSessionId());
         } else {
             $this->tell("You are refused to enter this game!");
         }
     } else {
         Settings::portalBoost2($this->getPlayer());
         $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);
         }
     }
 }