Exemplo n.º 1
0
 public function onAuthenticate(PlayerAuthenticateEvent $ev)
 {
     if (!$this->cfg["hide-unauth"]) {
         return;
     }
     $pl = $ev->getPlayer();
     $this->getServer()->broadcastMessage(TextFormat::YELLOW . mc::_("%1% has just joined", $pl->getDisplayName()));
     foreach ($this->getServer()->getOnlinePlayers() as $online) {
         $online->showPlayer($pl);
         if ($this->auth->isPlayerAuthenticated($online)) {
             $pl->showPlayer($online);
         }
     }
 }
 /**
  * @api
  *
  * @param Player $player
  *
  * @return bool True if call not blocked
  */
 public function authenticatePlayer(Player $player)
 {
     if ($this->isPlayerAuthenticated($player)) {
         return true;
     }
     $this->getServer()->getPluginManager()->callEvent($ev = new PlayerAuthenticateEvent($this, $player));
     if ($ev->isCancelled()) {
         return false;
     }
     if (isset($this->needAuth[spl_object_hash($player)])) {
         $attachment = $this->needAuth[spl_object_hash($player)];
         $player->removeAttachment($attachment);
         unset($this->needAuth[spl_object_hash($player)]);
     }
     $this->provider->updatePlayer($player, $player->getUniqueId(), time());
     $player->sendMessage(TextFormat::GREEN . $this->getMessage("login.success"));
     $this->getMessageTask()->removePlayer($player);
     unset($this->blockSessions[$player->getAddress() . ":" . strtolower($player->getName())]);
     return true;
 }
 public function onAuth(PlayerAuthenticateEvent $event)
 {
     if (Main::$ACTIVITY_DEFINITION === Main::ACTIVITY_AUTH) {
         $this->main->onLoggedIn($event->getPlayer());
     }
 }
 /**
  * @param PlayerAuthenticateEvent $event
  *
  * @priority        MONITOR
  * @ignoreCancelled true
  */
 public function onAuth(PlayerAuthenticateEvent $event)
 {
     $this->hub->onPlayerAuth($event->getPlayer());
 }