public function auth($method)
{
$this->authenticated = true;
$this->getPlayer()->setDisplayName(substr($this->getPlayer()->getDisplayName(), strlen(self::UNAUTHENTICATED_TAG)));
$teamStr = "";
if (($team = $this->getTeam()) instanceof Team) {
$teamrank = Team::$RANK_NAMES[$this->getMysqlSession()->data["teamrank"]];
$teamStr = "Team " . TextFormat::AQUA . $team->name . "\n" . TextFormat::LIGHT_PURPLE . $teamrank . TextFormat::WHITE . "\n";
}
$this->getPlayer()->setNameTag($teamStr . $this->getPlayer()->getNameTag());
if ($method) {
$this->tell("You have been authenticated by {$method}.");
}
$this->tell("Welcome to LegionPE.");
$this->main->getStats()->increment(LegionPE::TITLE_LEGIONPE_JOINS);
$this->subscribeToChannel($this->getMain()->getMandatoryChannel());
$this->perm->setPermission("pocketmine.command.list", true);
$isMod = ($this->getRank() & Settings::RANK_PERM_MOD) === Settings::RANK_PERM_MOD;
$isAdmin = ($this->getRank() & Settings::RANK_PERM_ADMIN) === Settings::RANK_PERM_ADMIN;
if ($isMod) {
$this->subscribeToChannel($this->getMain()->getSupportChannel());
$this->subscribeToChannel($this->getMain()->getStaffChannel());
}
$this->perm->setPermission("pocketmine.command.say", $isMod);
$this->perm->setPermission("pocketmine.command.gamemode", $isMod);
$this->perm->setPermission("pocketmine.command.status", $isMod);
$this->perm->setPermission("pocketmine.command.teleport", $isMod);
$this->perm->setPermission("pocketmine.command.time", $isMod);
$this->perm->setPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $isMod);
$this->perm->setPermission("pocketmine.command.give", $isAdmin);
$this->perm->setPermission("pocketmine.command.reload", $isAdmin);
$this->perm->setPermission("pocketmine.command.stop", $isAdmin);
$this->perm->setPermission("specter.command", $isAdmin);
$this->session = self::SESSION_GAME_HUB;
$this->disableTpListener = true;
$this->teleport($this->spawningPosition);
$this->disableTpListener = false;
$team = $this->getTeam();
if ($team instanceof Team) {
$this->subscribeToChannel($team->getChannel());
}
$game = Settings::getGameByLevel($l = $this->spawningPosition->getLevel(), $this->main);
if ($game instanceof Game) {
$this->joinGame($game);
} else {
$this->onHub();
}
$this->setVisible(self::INVISIBLE_UNAUTH);
$this->mysqlSession->data["lastonline"] = time();
$this->mysqlSession->data["lastip"] = $this->getPlayer()->getAddress();
$ips = explode(",", $this->mysqlSession->data["histip"]);
if (!in_array($this->getPlayer()->getAddress(), $ips)) {
$ips[] = $this->getPlayer()->getAddress();
$this->mysqlSession->data["histip"] = implode(",", $ips);
}
$this->tell("Limited 25% discount on all ranks ending on Friday! View them here: www.legionpvp.eu");
}