Example #1
0
 protected function run(Session $ses, array $args)
 {
     if (!$ses->switchSession(Session::SESSION_GAME_HUB)) {
         return TextFormat::RED . "Failed to quit - you are not in a game, or your game refused to let you go.";
     }
     $ses->teleport(Settings::loginSpawn($this->getPlugin()->getServer()));
     return TextFormat::GREEN . "You are now at hub.";
 }
Example #2
0
 /**
  * @param Session $session
  * @return bool allow join
  */
 public function onJoin(Session $session)
 {
     $this->playerData[$session->getUID()] = new SpleefSessionData($this, $session);
     $session->tell("%s, welcome to Spleef.", $session->getPlayer()->getName());
     $session->teleport($spawn = Settings::spleef_spawn($this->getMain()->getServer()));
     $session->getPlayer()->setSpawn($spawn);
     if ($session->getPlayer()->getGamemode() === 2) {
         $session->getPlayer()->setGamemode(0);
     }
     return true;
 }
Example #3
0
 public function onMove(Session $session, PlayerMoveEvent $event)
 {
     if (Settings::parkour_isFallen($session->getPlayer())) {
         $data = $this->data[$session->getUID()];
         $session->teleport(Settings::parkour_checkpoint_startPos($data->getProgress(), $this->getMain()->getServer()));
         $data->setFalls($data->getFalls() + 1);
         $data->addTmpFalls();
     }
 }
Example #4
0
 public function onJoin(Session $session)
 {
     $uid = $session->getUID();
     $data = $this->main->getMySQLi()->query("SELECT * FROM kitpvp WHERE uid={$uid};", MysqlConnection::ASSOC);
     if (is_array($data)) {
         $this->playerData[$uid] = new PvpSessionData($this, $session->getPlayer()->getGamemode(), $uid, $session, $data);
     } else {
         $this->playerData[$uid] = new PvpSessionData($this, $session->getPlayer()->getGamemode(), $uid, $session);
         $this->getMain()->getStats()->increment(LegionPE::TITLE_KITPVP_NEW_JOINS);
     }
     $session->tell("%s, welcome to KitPvP.", $session->getPlayer()->getName());
     $session->teleport($spawn = Settings::kitpvp_spawn($this->main->getServer()));
     foreach ($this->chunkListener->getSpawnedModels() as $model) {
         $model->spawnTo($session->getPlayer());
     }
     $session->getPlayer()->setSpawn($spawn);
     //		$session->tell($this->onFriendInboxCommand($session));
     $this->getMain()->getStats()->increment(LegionPE::TITLE_KITPVP_JOINS);
     $this->giveKits($session);
     if ($session->getPlayer()->getGamemode() === 0) {
         $session->getPlayer()->setGamemode(2);
     }
     return true;
 }